You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -102,45 +64,7 @@ Click the accordions below to expand/collapse the accordion content.
102
64
103
65
Add `flush` to remove the default `background-color`, some borders, and some rounded corners to render accordions edge-to-edge with their parent container.
React Alert is prepared for any length of text, as well as an optional close button. For a styling, use one of the **required** contextual `color` props (e.g., `primary`). For inline dismissal, use the [dismissing prop](#dismissing).
26
20
27
-
<Example>
28
-
<CAlertcolor="primary">
29
-
A simple primary alert—check it out!
30
-
</CAlert>
31
-
<CAlertcolor="secondary">
32
-
A simple secondary alert—check it out!
33
-
</CAlert>
34
-
<CAlertcolor="success">
35
-
A simple success alert—check it out!
36
-
</CAlert>
37
-
<CAlertcolor="danger">
38
-
A simple danger alert—check it out!
39
-
</CAlert>
40
-
<CAlertcolor="warning">
41
-
A simple warning alert—check it out!
42
-
</CAlert>
43
-
<CAlertcolor="info">
44
-
A simple info alert—check it out!
45
-
</CAlert>
46
-
<CAlertcolor="light">
47
-
A simple light alert—check it out!
48
-
</CAlert>
49
-
<CAlertcolor="dark">
50
-
A simple dark alert—check it out!
51
-
</CAlert>
52
-
</Example>
53
-
54
-
```jsx
21
+
```jsx preview
55
22
<CAlert color="primary">
56
23
A simple primary alert—check it out!
57
24
</CAlert>
@@ -81,7 +48,10 @@ React Alert is prepared for any length of text, as well as an optional close but
81
48
<CCalloutcolor="info">
82
49
<h5>Conveying meaning to assistive technologies</h5>
83
50
<p>
84
-
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the `.visually-hidden` class.
51
+
Using color to add meaning only provides a visual indication, which will not be conveyed to
52
+
users of assistive technologies – such as screen readers. Ensure that information denoted by the
53
+
color is either obvious from the content itself (e.g. the visible text), or is included through
54
+
alternative means, such as additional text hidden with the `.visually-hidden` class.
<p>Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.</p>
182
-
<hr />
183
-
<pclassName="mb-0">Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p>
<p>Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works withthis kind of content.</p>
129
+
<p>
130
+
Aww yeah, you successfully read this important alert message. This example text is going to run
131
+
a bit longer so that you can see how spacing within an alert works withthis kind of content.
132
+
</p>
191
133
<hr />
192
-
<p className="mb-0">Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p>
134
+
<p className="mb-0">
135
+
Whenever you need to, be sure to use margin utilities to keep things nice and tidy.
136
+
</p>
193
137
</CAlert>
194
138
```
195
139
196
140
### Icons
197
141
198
142
Similarly, you can use [flexbox utilities](https//coreui.io/docs/4.0/utilities/flex") and [CoreUI Icons](https://icons.coreui.io) to create react alerts with icons. Depending on your icons and content, you may want to add more utilities or custom styles.
Use `variant="solid"` to change contextual colors to solid.
281
197
282
-
<Example>
283
-
<CAlertcolor="primary"variant="solid">A simple solid primary alert—check it out!</CAlert>
284
-
<CAlertcolor="secondary"variant="solid">A simple solid secondary alert—check it out!</CAlert>
285
-
<CAlertcolor="success"variant="solid">A simple solid success alert—check it out!</CAlert>
286
-
<CAlertcolor="danger"variant="solid">A simple solid danger alert—check it out!</CAlert>
287
-
<CAlertcolor="warning"variant="solid">A simple solid warning alert—check it out!</CAlert>
288
-
<CAlertcolor="info"variant="solid">A simple solid info alert—check it out!</CAlert>
289
-
<CAlertcolor="light"variant="solid"className="text-high-emphasis">A simple solid light alert—check it out!</CAlert>
290
-
<CAlertcolor="dark"variant="solid">A simple solid dark alert—check it out!</CAlert>
291
-
</Example>
292
-
293
-
```jsx
198
+
```jsx preview
294
199
<CAlert color="primary" variant="solid">A simple solid primary alert—check it out!</CAlert>
295
200
<CAlert color="secondary" variant="solid">A simple solid secondary alert—check it out!</CAlert>
296
201
<CAlert color="success" variant="solid">A simple solid success alert—check it out!</CAlert>
@@ -305,24 +210,12 @@ Use `variant="solid"` to change contextual colors to solid.
305
210
306
211
React Alert component can also be easily dismissed. Just add the `dismissible` prop.
307
212
308
-
<Example>
309
-
<CAlert
310
-
color="warning"
311
-
dismissible
312
-
onClose={() => {
313
-
alert("👋 Well, hi there! Thanks for dismissing me.");
314
-
}}
315
-
>
316
-
<strong>Go right ahead</strong> and click that dimiss over there on the right.
317
-
</CAlert>
318
-
</Example>
319
-
320
-
```jsx
213
+
```jsx preview
321
214
<CAlert
322
215
color="warning"
323
216
dismissible
324
217
onClose={() => {
325
-
alert("👋 Well, hi there! Thanks for dismissing me.");
218
+
alert('👋 Well, hi there! Thanks for dismissing me.')
326
219
}}
327
220
>
328
221
<strong>Go right ahead</strong> and click that dimiss over there on the right.
@@ -331,7 +224,9 @@ React Alert component can also be easily dismissed. Just add the `dismissible` p
331
224
332
225
<CCalloutcolor="warning">
333
226
<p>
334
-
When an alert is dismissed, the element is completely removed from the page structure. If a keyboard user dismisses the alert using the close button, their focus will suddenly be lost and, depending on the browser, reset to the start of the page/document.
227
+
When an alert is dismissed, the element is completely removed from the page structure. If a
228
+
keyboard user dismisses the alert using the close button, their focus will suddenly be lost and,
229
+
depending on the browser, reset to the start of the page/document.
335
230
</p>
336
231
</CCallout>
337
232
@@ -355,9 +250,9 @@ React alerts use local CSS variables on `.alert` for enhanced real-time customiz
355
250
#### How to use CSS variables
356
251
357
252
```jsx
358
-
constvars= {
253
+
constvars= {
359
254
'--my-css-var':10,
360
-
'--my-another-css-var':"red"
255
+
'--my-another-css-var':'red',
361
256
}
362
257
return<CAlert style={vars}>...</CAlert>
363
258
```
@@ -389,4 +284,4 @@ $alert-dismissible-padding-r: $alert-padding-x * 3; // 3x covers width of x pl
0 commit comments