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
React toasts are lightweight notifications designed to mimic the push notifications that have been popularized by mobile and desktop operating systems. They’re built with flexbox, so they’re easy to align and position.
@@ -30,8 +34,8 @@ To encourage extensible and predictable toasts, we recommend a header and body.
30
34
Toasts are as flexible as you need and have very little required markup. At a minimum, we require a single element to contain your "toasted" content and strongly encourage a dismiss button.
31
35
32
36
<Playground>
33
-
<CToast
34
-
icon={
37
+
<CToasttitle="CoreUI for React.js"autohide={false}>
38
+
<CToastHeaderclose>
35
39
<svg
36
40
className="rounded me-2"
37
41
width="20"
@@ -43,24 +47,179 @@ Toasts are as flexible as you need and have very little required markup. At a mi
<strongclassName="me-auto">CoreUI for React.js</strong>
155
+
<small>7 min ago</small>
156
+
</CToastHeader>
157
+
<CToastBody>Hello, world! This is a toast message.</CToastBody>
158
+
</CToast>
159
+
</CToaster>
160
+
</Playground>
161
+
162
+
### Custom content
163
+
164
+
Customize your toasts by removing sub-components, tweaking them with [utilities](https://coreui.io/docs/4.0/utilities/api"), or by adding your own markup. Here we've created a simpler toast by removing the default `.<CToastHeader>`, adding a custom hide icon from [CoreUI Icons](https://icons.coreui.io), and using some [flexbox utilities](https://coreui.io/docs/4.0/utilities/flex") to adjust the layout.
Building on the above example, you can create different toast color schemes with our [color]({{< docsref "/utilities/colors" >}}) and [background]({{< docsref "/utilities/background" >}}) utilities. Here we've added `.bg-primary` and `.text-white` to the `.toast`, and then added `.btn-close-white` to our close button. For a crisp edge, we remove the default border with `.border-0`.
0 commit comments