Alert
Contextual feedback message with intent colors, optional title, dismiss button and icon slots.
Preview
Rendering the live preview…
successRendering the live preview…
dangerRendering the live preview…
warningRendering the live preview…
infoRendering the live preview…
closableStructure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-alert> — 7 internal parts in a CSS grid (prepend | content | close). The underlay ⑦ is an absolute decorative layer behind the content.- 1.origam-alert
- Root element. CSS grid with 4 columns: prepend / content / append / close.
role="alert"(assertive) for warning/error,role="status"(polite) for info/success. - 2.origam-alert__prepend
- Leading area (grid-area: prepend). Renders
prependIconorprependAvatar, or the#prependslot. - 3.origam-alert__content
- Content container (grid-area: content). Holds the header (
__header) and body (__body). - 4.origam-alert__header
- Header area inside content. Contains the icon and/or title. Rendered only when
hasHeaderis true. - 5.origam-alert__body
- Body area. Contains the
#textslot ortextprop, plus the#defaultslot. - 6.origam-alert__close
- Close button area (grid-area: close). Rendered only when
closable=trueor the#closeslot is used. - 7.origam-alert__underlay
- Absolute decorative layer.
grid-area: none; position: absolute. Used for the colored border-radius adaptation in the inset border modifier.
API
Props
All props accepted by this component, with their type, default value and description.
- closablebooleanfalse
- Adds a close button that emits click:close and hides the alert via v-model.
- Icon used for the close button. Defaults to the MDI close icon.
- closeLabelstring'origam.close'
- Accessible aria-label for the close button.
- modelValuebooleantrue
- Controls the visibility of the alert. Use v-model to bind two-way.
- titlestring
- Bold title text rendered at the top of the alert body.
- textstring
- Alert body text. Can also be set via the default slot.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- tagstring'div'
- HTML element rendered at the root.
- color
- Intent or custom color applied to the alert surface.
- bgColor
- Background color override independent of the intent color.
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>false
- Applies a border. Pass true for the default or a CSS shorthand.
- borderTopboolean | number | string
- borderLeftboolean | number | string
- disabledbooleanfalse
- Disables interactive elements inside the alert.
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderColorstring
- Override border color without affecting width or style.
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
- heightnumber | string
- Overrides the alert height.
- maxHeightnumber | string
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- widthnumber | string
- Overrides the alert width.
- paddingboolean | number | string
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- marginboolean | number | string
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- Adjusts vertical and horizontal padding density.
- elevationTElevation
- Box-shadow elevation token. Adds the box-shadow-elevated when set.
- locationTAnchor
- positionTPosition
- CSS position property for the root element.
- topnumber | string
- bottomnumber | string
- leftnumber | string
- rightnumber | string
- Border-radius token or boolean.
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- statusTStatus
- statusIconPositionTStatusPosition
- iconTIcon
- hoverboolean | IStateEffectConfig
- hoverClassstring
- appendAvatarstring
- Image URL for an avatar in the append area.
- appendIcon
- Icon displayed in the append area (right of the alert text).
- prependAvatarstring
- Image URL for an avatar in the prepend area.
- prependIcon
- Icon displayed in the prepend area (left of the alert text).
- prependAriaLabelstring
- appendAriaLabelstring
- fontSizeTFontSize
- fontWeightTFontWeight
- lineHeightTLineHeight
- letterSpacingTLetterSpacing
API
Slots
Content slots exposed by this component.
- #wrapper
- Replaces the entire inner layout (prepend + content + append + close).
- #title
- Replaces the title rendering. Overrides the title prop.
- #text
- Replaces the text body rendering. Overrides the text prop.
- #default
- Main alert body content. Overrides the text prop.
- #close
- Replaces the close button with custom content.
- #prepend
- Replaces the prepend icon area with custom content.
- #append
- Replaces the append icon area with custom content.
API
Emits
Events emitted by this component.
- @update:modelValueany
- Fired when the alert is dismissed via the close button.
- @click:closeMouseEvent
- Fired when the user clicks the close button.
- @update:hoverboolean
- Propagates the hover state to the parent when hover tracking is enabled.
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.
- Ref<string>
- Reactive CSS string generated by useStyle from the computed alertStyles.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet into the document. Called automatically on mount.
- () => void
- Removes the injected style sheet. Called automatically on unmount.
- Ref<boolean>
- True once the style sheet has been injected into the DOM.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Default alert background color. Overridden by status (warning/success/info/error) and color prop.
- Default foreground color. Overridden by status colors.
- Border radius. Zero by default; overridden by the rounded prop.
- Top padding. Adjusted by density.
- Leading (left) padding. Adjusted by density.
- Density offset: comfortable=-8px, default=0px, compact=+8px.
- Box shadow for elevated variant (when elevation prop is set).
- Font size of the title area.
- Font weight of the title text.
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 close button when closable=true. |
| Enter / Space | Activates the close button when focused. |
Notes
- Alerts with status "warning" or "error" use role="alert" with aria-live="assertive". Other statuses use role="status" with aria-live="polite".
- The close button receives an aria-label from the closeLabel prop, defaulting to the translated "Close" string via the locale system.
- The component tracks hover state via @mouseenter/@mouseleave and propagates it via update:hover. Focus visible styles are applied for keyboard navigation.
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---disabled)
- Default alert background.
- dimensionvar(--origam-space---4)
- Default top/bottom block padding.
- colorvar(--origam-color__feedback--success---bg)
- Background for the success status variant.
- colorvar(--origam-color__feedback--warning---bg)
- Background for the warning status variant.
- colorvar(--origam-color__feedback--danger---bg)
- Background for the danger/error status variant.
- dimensionvar(--origam-font__size---2xl)
- Font size of the title area.
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.
Intent colors
Closable alert
Border accent