x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!-- Default scheme --><x-banner data-dismiss-scheme="none" data-view-component="true"> <div data-view-component="true" class="Banner flash"> <div class="Banner-visual"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path> </svg> </div> <div data-view-component="true" class="Banner-message"> <p class="Banner-title" data-target="x-banner.titleText">This is a default banner.</p> </div> </div></x-banner><!-- Danger --><x-banner data-dismiss-scheme="none" data-view-component="true"> <div data-view-component="true" class="Banner flash Banner--error flash-error"> <div class="Banner-visual"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-stop"> <path d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path> </svg> </div> <div data-view-component="true" class="Banner-message"> <p class="Banner-title" data-target="x-banner.titleText">This is a danger banner!</p> </div> </div></x-banner><!-- Success --><x-banner data-dismiss-scheme="none" data-view-component="true"> <div data-view-component="true" class="Banner flash Banner--success flash-success"> <div class="Banner-visual"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check-circle"> <path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm1.5 0a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm10.28-1.72-4.5 4.5a.75.75 0 0 1-1.06 0l-2-2a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018l1.47 1.47 3.97-3.97a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path> </svg> </div> <div data-view-component="true" class="Banner-message"> <p class="Banner-title" data-target="x-banner.titleText">This is a success banner!</p> </div> </div></x-banner><!-- Warning --><x-banner data-dismiss-scheme="none" data-view-component="true"> <div data-view-component="true" class="Banner flash Banner--warning flash-warn"> <div class="Banner-visual"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path> </svg> </div> <div data-view-component="true" class="Banner-message"> <p class="Banner-title" data-target="x-banner.titleText">This is a warning banner!</p> </div> </div></x-banner>
1
2
3
4
5
6
7
8
9
10
11
# Default schemerender(Primer::Alpha::Banner.new) { "This is a default banner." }# Dangerrender(Primer::Alpha::Banner.new(scheme: :danger)) { "This is a danger banner!" }# Successrender(Primer::Alpha::Banner.new(scheme: :success)) { "This is a success banner!" }# Warningrender(Primer::Alpha::Banner.new(scheme: :warning)) { "This is a warning banner!" }
No notes provided.
No params configured.
app/components/primer/alpha/banner.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* Banner alert */.Banner { position: relative; display: grid; padding: var(--base-size-8); color: var(--fgColor-default); background-image: linear-gradient(var(--bgColor-accent-muted), var(--bgColor-accent-muted)); border: var(--borderWidth-thin) solid var(--borderColor-accent-muted); border-radius: var(--borderRadius-medium); grid-auto-flow: column; grid-template-areas: 'visual message actions close'; grid-template-columns: min-content 1fr minmax(0, auto) min-content; grid-template-rows: min-content; /* `sm` breakpoint variantion */}@media (max-width: 543.98px) {.Banner { grid-template-areas: 'visual message close' '. actions actions'; grid-template-columns: min-content 1fr min-content; grid-template-rows: min-content min-content;} .Banner .Banner-actions { margin: var(--base-size-8) 0 0 var(--base-size-8); } }/* Elements */.Banner .Banner-visual { display: grid; padding: var(--base-size-6) var(--base-size-8); grid-area: visual; align-self: start; }:is(.Banner .Banner-visual) > .octicon { margin-block: calc(var(--base-size-4) / 2); }:is(.Banner .Banner-visual) > * { align-self: center; }.Banner .Banner-message { padding: var(--base-size-6) var(--base-size-8); grid-area: message; align-self: center; /* stylelint-disable-next-line selector-max-type */ }:is(.Banner .Banner-message) p:last-child { margin-bottom: 0; }:is(.Banner .Banner-message) .Banner-title:not(:only-child) { margin-bottom: 0; font-weight: var(--base-text-weight-semibold); }.Banner .Banner-actions { grid-area: actions; }:is(.Banner .Banner-actions):last-child { align-self: center; }/* is this used anywhere? could not find any use, but unsure */.Banner .Banner-close { grid-area: close; /* stylelint-disable-next-line primer/spacing */ margin-left: var(--controlStack-medium-gap-condensed); }.Banner .Banner-visual .octicon { color: var(--fgColor-accent); }.Banner.Banner--warning { color: var(--fgColor-default); background-image: linear-gradient(var(--bgColor-attention-muted), var(--bgColor-attention-muted)); border-color: var(--borderColor-attention-muted); }.Banner.Banner--warning .Banner-visual .octicon { color: var(--fgColor-attention); }.Banner.Banner--error { color: var(--fgColor-default); background-image: linear-gradient(var(--bgColor-danger-muted), var(--bgColor-danger-muted)); border-color: var(--borderColor-danger-muted); }.Banner.Banner--error .Banner-visual .octicon { color: var(--fgColor-danger); }.Banner.Banner--success { color: var(--fgColor-default); background-image: linear-gradient(var(--bgColor-success-muted), var(--bgColor-success-muted)); border-color: var(--borderColor-success-muted); }.Banner.Banner--success .Banner-visual .octicon { color: var(--fgColor-success); }/* Full-width */.Banner.Banner--full { /* stylelint-disable-next-line primer/spacing */ margin-top: calc(var(--borderWidth-thin) * -1); border-right: 0; border-left: 0; border-radius: 0; }@media (max-width: 767.98px) { .Banner.Banner--full-whenNarrow { /* stylelint-disable-next-line primer/spacing */ margin-top: calc(var(--borderWidth-thin) * -1); border-right: 0; border-left: 0; border-radius: 0; } }