SnackbarItem

Feedback & Status
stable

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…

info

Rendu de l’aperçu en cours…

success

Rendu de l’aperçu en cours…

warning

Rendu de l’aperçu en cours…

danger

Structure

Anatomie

Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.

Anatomy of OrigamSnackbarItemSchematic of the SnackbarItem component with 7 numbered internal parts. __content icon __text __title __message __actions ✕ 1 2 3 4 5 6 7
Anatomy of <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 #prepend slot or hidden when icon=false.
4.origam-snackbar-item__title
Bold first-line label. Rendered only when the title prop is set.
5.origam-snackbar-item__message
Body text. Rendered when the message prop or the #message slot is provided.
6.origam-snackbar-item__actions
Action buttons row. Rendered only when actions is non-empty or the #actions slot 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.

intent
'info'
Semantic intent — drives the icon default and the surface colouring via feedback tokens (primary, success, warning, danger, info).
title
string
Optional bold first line rendered above the message. Useful for short labels such as "Saved" or "Error".
message
string
Body text rendered under the title. Can be omitted when content is supplied via the default slot.
Prepend icon override. Omit to use the per-intent default. Pass false to suppress the icon entirely.
actions
ReadonlyArray<ISnackbarGroupItemAction>
Action buttons rendered inline after the text block. Each action fires handler() and dismisses the item unless keepOpen: true.
dismissible
boolean
true
Whether to render the close (x) dismiss button.
dismissLabel
string
'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".
dataCy
string
data-cy attribute injected on the root element so each toast is addressable in e2e tests.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
fontSize
TFontSize

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.

@dismiss
void
Fired when the user clicks the dismiss button.
@action
ISnackbarGroupItemAction
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

status
alert

Interactions clavier

Interactions clavier
ToucheAction
TabMoves focus to the dismiss button or action buttons.
Enter / SpaceActivates 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.

Source
color
var(--origam-color__surface---default)
Default background color. Intent variants reference feedback tokens.
dimension
var(--origam-radius---md)
Corner radius of the item card.
shadow
var(--origam-shadow---md)
Elevation shadow applied to the card.
fontWeight
var(--origam-font__weight---semibold)
Font weight of the title text.
number
0.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

vue

With actions

vue

Écosystème

Famille

Composants du même dossier qui partagent les conventions et se composent souvent ensemble.