Dialog
A modal panel over a backdrop, with Escape/backdrop-click to close and focus returned to the trigger.
fandry-dialog
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 |
|---|---|---|---|
open | boolean | false | Open state (consumer-controlled via ontoggle). |
label | string | '' | Accessible name for the dialog. |
aria-label | string | — | The same name, set the standard way. Wins over label. |
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 |
|---|---|
backdrop | The dimmed layer behind a modal panel, or a loading overlay's cover. |
panel | The surface that opens: a dropdown's list, a popover, a tooltip, a dialog, a loading overlay's box. |
<!-- template -->
<div class="brand row">
<fandry-button onclick={handleOpen}>Remove from cart</fandry-button>
<fandry-dialog open={isOpen} label="Remove from cart" ontoggle={handleToggle}>
<fandry-heading level="3">Remove Stride Runner?</fandry-heading>
<fandry-text variant="muted">You can add it back any time.</fandry-text>
<div class="row actions">
<fandry-button variant="secondary" onclick={handleClose}>Keep it</fandry-button>
<fandry-button onclick={handleClose}>Remove</fandry-button>
</div>
</fandry-dialog>
</div>
/* css */
/* Scoped to this demo. Set the same --fd-* tokens on :root to theme
every fandry-* component on the site. */
.brand {
--fd-primary: 160 84% 26%;
--fd-radius-lg: 1.25rem;
--fd-backdrop: 160 40% 10%;
}
fandry-dialog::part(panel) {
padding: 2rem;
border-top: 6px solid hsl(160 84% 26%);
}
fandry-dialog::part(backdrop) {
backdrop-filter: blur(4px);
}
Code
Link to section Code<fandry-dialog open={isOpen} label="Delete item" ontoggle={handleToggle}>
<fandry-heading level="3">Delete item?</fandry-heading>
<fandry-text variant="muted">This action can't be undone.</fandry-text>
</fandry-dialog>