SnackbarItem
Pure visual layer for a single toast notification. Handles intent theming, icon, title, message, action buttons and the dismiss control.
Preview
Rendering the live preview…
infoRendering the live preview…
successRendering the live preview…
warningRendering the live preview…
dangerStructure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<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
All props accepted by this component, with their type, default value and 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
Content slots exposed by this component.
- #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
Events emitted by this component.
- @dismissvoid
- Fired when the user clicks the dismiss button.
- @actionISnackbarGroupItemAction
- Fired when the user clicks an action button, forwarding the action descriptor.
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props to a child component.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- 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
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
ARIA roles
Keyboard interactions
| Key | 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.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- 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.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Intents
With actions
Ecosystem
Family
Components from the same folder that share conventions and often compose together.