Toast Viewport
A fixed or contained stacking region that positions fandry-toast.
fandry-toast-viewport
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 |
|---|---|---|---|
placement | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'bottom-right' | Corner to stack from. |
contained | boolean | false | position: absolute against the nearest positioned ancestor instead of the viewport. |
label | string | '' | Accessible label for the stacking region. |
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 |
|---|---|
base | The outermost element. |
<!-- template -->
<div class="brand panel">
<fandry-button variant="secondary" onclick={handleAdd}>Add to cart</fandry-button>
<fandry-toast-viewport placement="bottom-right" contained label="Notifications">
<template for:each={toasts} for:item="toast">
<fandry-toast key={toast.id} data-id={toast.id} variant="success" duration="3000" ondismiss={handleDismiss}>
{toast.message}
</fandry-toast>
</template>
</fandry-toast-viewport>
</div>
/* css */
/* Scoped to this demo. Set the same --fd-* tokens on :root to theme
every fandry-* component on the site. */
.brand {
--fd-success: 160 84% 26%;
--fd-radius-md: 0.75rem;
}
fandry-toast::part(base) {
font-weight: 600;
border-left-width: 6px;
background: hsl(160 40% 97%);
}
fandry-toast-viewport::part(base) {
gap: 0.75rem;
}
Code
Link to section Code<fandry-toast-viewport placement="bottom-right" label="Notifications"> <fandry-toast variant="info">Heads up.</fandry-toast> </fandry-toast-viewport>