Alert
An inline banner for a status message, with an optional title.
fandry-alert
Example
Link to section ExampleCustom colors and parts
Link to section Custom colors and partsThe same component with a few --fd-* tokens set around it and its parts restyled. The code is under Parts below.
Props
Link to section Props| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'info' | 'success' | 'warning' | 'danger' | 'info' | Status color and icon. |
title | string | '' | Optional bold title above the message. |
title (slot) | slot | the title prop | Markup in place of the title. Shown even without the title prop. |
Parts
Link to section PartsStyle the elements inside the component from your own CSS with ::part(). Every fandry component renders in native shadow DOM, so parts work on LWR and Salesforce alike. For colors, spacing, radius and type across many components, set the --fd-* tokens instead. The code for the "Custom colors and parts" example above:
| Part | Description |
|---|---|
base | The outermost element. |
title | The title line. |
body | The content below the title. |
States are extra names on a part while the state is on. Name both to style one state, e.g.fandry-checkbox::part(control checked).
| State | Description |
|---|---|
info | variant="info". |
success | variant="success". |
warning | variant="warning". |
danger | variant="danger". |
<!-- template -->
<div class="brand stack">
<fandry-alert title="Free shipping">Orders over $50 ship free, anywhere in the EU.</fandry-alert>
<fandry-alert variant="success" title="Order placed">We'll email you when it ships.</fandry-alert>
</div>
/* css */
/* Scoped to this demo. Set the same --fd-* tokens on :root to theme
every fandry-* component on the site. */
.brand {
--fd-info: 45 90% 40%;
--fd-success: 160 84% 26%;
--fd-radius-md: 0.75rem;
--fd-surface-tint: 10%;
}
fandry-alert::part(base) {
border-left-width: 6px;
}
fandry-alert::part(title) {
font-size: 0.75rem;
letter-spacing: 0.06em;
text-transform: uppercase;
}
Code
Link to section Code<fandry-alert variant="success" title="Saved">Your changes have been saved.</fandry-alert>