Previews

No matching results.

x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!-- Full width -->
<div data-view-component="true" class="flash flash-full">
This is a full width flash message!
</div>
<!-- Dismissible -->
<div data-view-component="true" class="flash">
This is a dismissible flash message!
<button id="icon-button-0a7fe67a-f133-4695-993a-444ebd60c0c0" aria-labelledby="tooltip-8d307943-af40-441e-b46f-c293837cb66e" type="button" data-view-component="true" class="Button Button--iconOnly Button--invisible Button--medium flash-close js-flash-close"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x Button-visual">
<path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>
</svg>
</button><tool-tip id="tooltip-8d307943-af40-441e-b46f-c293837cb66e" for="icon-button-0a7fe67a-f133-4695-993a-444ebd60c0c0" popover="manual" data-direction="s" data-type="label" data-view-component="true" class="sr-only position-absolute">Dismiss alert</tool-tip>
</div>
<!-- With icon -->
<div data-view-component="true" class="flash">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-info">
<path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path>
</svg>This is a flash message with an icon!
</div>
1
2
3
4
5
6
7
8
# Full width
render(Primer::Beta::Flash.new(full: true)) { "This is a full width flash message!" }
# Dismissible
render(Primer::Beta::Flash.new(dismissible: true)) { "This is a dismissible flash message!" }
# With icon
render(Primer::Beta::Flash.new(icon: :info)) { "This is a flash message with an icon!" }

app/components/primer/beta/flash.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
137
138
139
140
141
142
143
144
145
146
147
148
149
/* flash */
/* Default flash */
.flash:not(.Banner) {
position: relative;
padding: var(--base-size-20) var(--control-medium-paddingInline-spacious);
border-style: solid;
border-width: var(--borderWidth-thin);
border-radius: var(--borderRadius-medium);
/* Default color */
color: var(--fgColor-default);
background-image: linear-gradient(var(--bgColor-accent-muted), var(--bgColor-accent-muted));
border-color: var(--borderColor-accent-muted);
}
.flash:not(.Banner) .octicon {
color: var(--fgColor-accent);
margin-right: var(--base-size-12);
}
.flash:not(.Banner) p:last-child {
margin-bottom: 0;
}
/* Contain the flash messages */
.flash-messages {
margin-bottom: var(--stack-gap-spacious);
}
/* Close button */
.flash-close:not(.Banner-close) {
float: right;
margin-top: calc(var(--base-size-4) * -1);
text-align: center;
cursor: pointer;
/* Undo `<button>` styles */
background: none;
border: 0;
-webkit-appearance: none;
appearance: none;
}
.flash-close:not(.Banner-close):hover {
opacity: 0.7;
}
.flash-close:not(.Banner-close):active {
opacity: 0.5;
}
.flash-close:not(.Banner-close) .octicon {
margin-right: 0;
}
/* Action button */
.flash-action:not(.Banner-actions) {
float: right;
margin-top: -3px;
margin-left: var(--stack-gap-spacious);
background-clip: padding-box;
}
.flash-action.btn:not(.Banner-actions) .octicon {
margin-right: var(--control-small-gap);
color: var(--fgColor-muted);
}
.flash-action.btn-primary:not(.Banner-actions) {
background-clip: border-box;
}
.flash-action.btn-primary:not(.Banner-actions) .octicon {
color: inherit;
}
/* Color variations */
.flash-warn:not(.Banner) {
color: var(--fgColor-default);
background-image: linear-gradient(var(--bgColor-attention-muted), var(--bgColor-attention-muted));
border-color: var(--borderColor-attention-muted);
}
.flash-warn:not(.Banner) .octicon {
color: var(--fgColor-attention);
}
.flash-error:not(.Banner) {
color: var(--fgColor-default);
background-image: linear-gradient(var(--bgColor-danger-muted), var(--bgColor-danger-muted));
border-color: var(--borderColor-danger-muted);
}
.flash-error:not(.Banner) .octicon {
color: var(--fgColor-danger);
}
.flash-success:not(.Banner) {
color: var(--fgColor-default);
background-image: linear-gradient(var(--bgColor-success-muted), var(--bgColor-success-muted));
border-color: var(--borderColor-success-muted);
}
.flash-success:not(.Banner) .octicon {
color: var(--fgColor-success);
}
/* Layout variations */
.flash-full:not(.Banner) {
margin-top: calc(var(--borderWidth-thin) * -1);
border-width: var(--borderWidth-thin) 0;
border-radius: 0;
}
/* A banner rendered at the top of the page. */
.flash-banner {
position: fixed;
top: 0;
z-index: 90;
width: 100%;
border-top: 0;
border-right: 0;
border-left: 0;
border-radius: 0;
}
/* Makes sure the background is opaque to cover any content underneath */
.flash-full,
.flash-banner {
background-color: var(--bgColor-default);
}
/* FIXME deprecate this */
.warning {
padding: 0.5em;
margin-bottom: 0.8em;
font-weight: var(--base-text-weight-semibold);
background-color: var(--bgColor-attention-muted);
}