SnackbarItem
Pure visual layer for a single toast notification. Handles intent theming, icon, title, message, action buttons and the dismiss control.
Aperçu
Rendu de l’aperçu en cours…
infoRendu de l’aperçu en cours…
successRendu de l’aperçu en cours…
warningRendu de l’aperçu en cours…
dangerStructure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-snackbar-item> — 7 internal parts. The __content row holds the prepend icon and the text block; __actions and __dismiss are appended when present.- 1.origam-snackbar-item
- Root element. Carries the intent modifier class (e.g.
--intent-success) and the role / aria-live / aria-atomic attributes. - 2.origam-snackbar-item__content
- Flex row hosting the prepend icon and the text block.
- 3.origam-snackbar-item__prepend
- Leading icon area. Defaults to the per-intent MDI icon; replaced by the
#prependslot or hidden whenicon=false. - 4.origam-snackbar-item__title
- Bold first-line label. Rendered only when the
titleprop is set. - 5.origam-snackbar-item__message
- Body text. Rendered when the
messageprop or the#messageslot is provided. - 6.origam-snackbar-item__actions
- Action buttons row. Rendered only when
actionsis non-empty or the#actionsslot is used. - 7.origam-snackbar-item__dismiss
- Close button (OrigamBtn icon x-small). Hidden when
dismissible=false.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- Semantic intent — drives the icon default and the surface colouring via feedback tokens (primary, success, warning, danger, info).
- titlestring
- Optional bold first line rendered above the message. Useful for short labels such as "Saved" or "Error".
- messagestring
- Body text rendered under the title. Can be omitted when content is supplied via the default slot.
- icon
- Prepend icon override. Omit to use the per-intent default. Pass false to suppress the icon entirely.
- actionsReadonlyArray<ISnackbarGroupItemAction>
- Action buttons rendered inline after the text block. Each action fires handler() and dismisses the item unless keepOpen: true.
- dismissiblebooleantrue
- Whether to render the close (x) dismiss button.
- dismissLabelstring'Dismiss notification'
- Accessible label for the dismiss button. Defaults to the DS locale key origam.snackbar.dismiss.
- role'status' | 'alert'
- ARIA role. Inferred from intent when not set: warning / danger → "alert", others → "status".
- ariaLive'polite' | 'assertive'
- ARIA live region politeness. Inferred from intent when not set: warning / danger → "assertive", others → "polite".
- dataCystring
- data-cy attribute injected on the root element so each toast is addressable in e2e tests.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- fontSizeTFontSize
API
Slots
Emplacements de contenu exposés par ce composant.
- #prepend
- Replaces the intent icon with custom content.
- #title
- Replaces the title text with custom content. Rendered only when the title prop is set.
- #message
- Replaces the message text with custom content.
- #default
- Additional content rendered inside the text block after the message.
- #actions
- Replaces the rendered action buttons with custom content.
API
Emits
Événements émis par ce composant.
- @dismissvoid
- Fired when the user clicks the dismiss button.
- @actionISnackbarGroupItemAction
- Fired when the user clicks an action button, forwarding the action descriptor.
API
Membres exposés
Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props to a child component.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- Gap between the prepend area and the text+actions block.
- Minimum width of the item.
- Maximum width of the item.
- Inner padding of the item.
- Corner radius of the item card.
- Default background. Intent variants override this via feedback tokens.
- Default border colour. Intent variants override this via feedback tokens.
- Elevation shadow for the item card.
- Font weight of the title line.
- Opacity of the message text, giving the title visual priority.
Inclusion
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Rôles ARIA
Interactions clavier
| Touche | Action |
|---|---|
| Tab | Moves focus to the dismiss button or action buttons. |
| Enter / Space | Activates the focused dismiss or action button. |
Notes
- aria-live is set to "assertive" for warning and danger intents, "polite" for others. The value can be overridden via the ariaLive prop.
- aria-atomic="true" ensures screen readers read the entire item when it is updated.
- The dismiss button carries aria-label="Dismiss notification" (or the dismissLabel prop value). It is keyboard-focusable and activated via Enter/Space.
- The v-contrast directive ensures foreground and background token combinations meet WCAG AA contrast ratios for each intent.
Fondation
Design tokens
Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.
- colorvar(--origam-color__surface---default)
- Default background color. Intent variants reference feedback tokens.
- dimensionvar(--origam-radius---md)
- Corner radius of the item card.
- shadowvar(--origam-shadow---md)
- Elevation shadow applied to the card.
- fontWeightvar(--origam-font__weight---semibold)
- Font weight of the title text.
- number0.85
- Opacity of the message text.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Intents
With actions
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.