Alert

Feedback & Status
stable

Contextual feedback message with intent colors, optional title, dismiss button and icon slots.

Preview

Rendering the live preview…

success

Rendering the live preview…

danger

Rendering the live preview…

warning

Rendering the live preview…

info

Rendering the live preview…

closable

Structure

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

Anatomy of OrigamAlertSchematic of the Alert component with 7 numbered internal parts. prepend Header (icon + title) Body / #default slot close 1 2 3 4 5 6 7 ⑦ underlay = absolute layer, decorative
Anatomy of <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 prependIcon or prependAvatar, or the #prepend slot.
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 hasHeader is true.
5.origam-alert__body
Body area. Contains the #text slot or text prop, plus the #default slot.
6.origam-alert__close
Close button area (grid-area: close). Rendered only when closable=true or the #close slot 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.

closable
boolean
false
Adds a close button that emits click:close and hides the alert via v-model.
closeIcon
'mdi-close'
Icon used for the close button. Defaults to the MDI close icon.
closeLabel
string
'origam.close'
Accessible aria-label for the close button.
modelValue
boolean
true
Controls the visibility of the alert. Use v-model to bind two-way.
title
string
Bold title text rendered at the top of the alert body.
text
string
Alert body text. Can also be set via the default slot.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
tag
string
'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.
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
false
Applies a border. Pass true for the default or a CSS shorthand.
borderTop
boolean | number | string
borderLeft
boolean | number | string
disabled
boolean
false
Disables interactive elements inside the alert.
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
Override border color without affecting width or style.
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
height
number | string
Overrides the alert height.
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
width
number | string
Overrides the alert width.
padding
boolean | number | string
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
margin
boolean | number | string
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
density
'default'
Adjusts vertical and horizontal padding density.
elevation
TElevation
Box-shadow elevation token. Adds the box-shadow-elevated when set.
location
TAnchor
position
TPosition
CSS position property for the root element.
top
number | string
bottom
number | string
left
number | string
right
number | string
Border-radius token or boolean.
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
status
TStatus
statusIconPosition
TStatusPosition
icon
TIcon
hover
boolean | IStateEffectConfig
hoverClass
string
appendAvatar
string
Image URL for an avatar in the append area.
appendIcon
Icon displayed in the append area (right of the alert text).
prependAvatar
string
Image URL for an avatar in the prepend area.
prependIcon
Icon displayed in the prepend area (left of the alert text).
prependAriaLabel
string
appendAriaLabel
string
fontSize
TFontSize
fontWeight
TFontWeight
lineHeight
TLineHeight
letterSpacing
TLetterSpacing

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:modelValue
any
Fired when the alert is dismissed via the close button.
@click:close
MouseEvent
Fired when the user clicks the close button.
@update:hover
boolean
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

alert
status

Keyboard interactions

Keyboard interactions
KeyAction
TabMoves focus to the close button when closable=true.
Enter / SpaceActivates 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.

Source
color
var(--origam-color__surface---disabled)
Default alert background.
dimension
var(--origam-space---4)
Default top/bottom block padding.
color
var(--origam-color__feedback--success---bg)
Background for the success status variant.
color
var(--origam-color__feedback--warning---bg)
Background for the warning status variant.
color
var(--origam-color__feedback--danger---bg)
Background for the danger/error status variant.
dimension
var(--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

vue

Closable alert

vue

Border accent

vue