Skip to content

OrigamAlert ​

<OrigamAlert> is a contextual feedback banner. It renders as a <div> with role="alert" and supports status icons, a title, body text, a close button, elevation, hover effects, and all colour/density/rounded mixins.

The component is visible only when modelValue is true (default). The close button sets it to false and emits click:close.

Basic usage ​

vue
<template>
    <OrigamAlert text="Something went wrong." />
</template>

Status / intent ​

Use status for semantic colouring with a matching icon.

vue
<template>
    <OrigamAlert status="success" title="Done!"    text="Your file was saved."       />
    <OrigamAlert status="info"    title="Heads up"  text="A new version is available." />
    <OrigamAlert status="warning" title="Warning"   text="Storage almost full."        />
    <OrigamAlert status="error"   title="Error"     text="Connection timed out."        />
</template>

Closable ​

vue
<template>
    <OrigamAlert v-model="visible" closable text="Dismiss me." />
</template>

<script setup lang="ts">
import { ref } from 'vue'
const visible = ref(true)
</script>

Title ​

vue
<template>
    <OrigamAlert title="Custom title" text="Alert body text." />
</template>

Color ​

vue
<template>
    <OrigamAlert color="primary" text="Primary alert" />
</template>

Density ​

vue
<template>
    <OrigamAlert density="compact"     text="Compact"     />
    <OrigamAlert density="default"     text="Default"     />
    <OrigamAlert density="comfortable" text="Comfortable" />
</template>

Typography (title surface) ​

fontSize, fontWeight, letterSpacing, and lineHeight override the corresponding CSS variables on the __title BEM child (<span class="origam-alert__title">). The styles are bound inline on that element via useTypography(props, 'alert__title').

fontFamily is not part of this component's typed surface — IAlertProps narrows ITypographyProps to the props the __title SCSS actually reads (issue #501). fontFamily is a project-level setting (configured once on OrigamApp), not a per-instance override.

vue
<template>
    <OrigamAlert
        title="Bold large title"
        text="Body text remains at theme size."
        font-size="xl"
        font-weight="bold"
        letter-spacing="wide"
        line-height="loose"
    />
</template>

Typography props ​

PropTypeCSS variable setEffect
fontSizeTFontSize--origam-alert__title---font-sizeTitle font-size token.
fontWeightTFontWeight--origam-alert__title---font-weightTitle font-weight token.
letterSpacingTLetterSpacing--origam-alert__title---letter-spacingTitle letter-spacing token.
lineHeightTLineHeight--origam-alert__title---line-heightTitle line-height token.

Props ​

IAlertProps declares six props of its own and inherits the rest from the Commons interfaces. The tables below are grouped the same way the story's #controls panel is, so a control you see in Histoire maps to a row here.

Content & behaviour ​

PropTypeDefaultDescription
modelValuebooleantrueVisibility. The close button sets it to false.
titlestring—Title rendered in the __title BEM child. Overridden by the title slot.
textstring—Body text. Overridden by the text slot.
closablebooleanfalseRenders the close button.
closeIconTIconMDI_ICONS.CLOSEIcon of the close button.
closeLabelstring'origam.close'Translation key resolved through useLocale() for the close button's aria-label. Pass a key, not a literal.

Status & icons ​

PropTypeDefaultDescription
statusTStatus—Semantic intent (info, success, warning, error). Paints the surface and selects the default icon.
statusIconPositionTStatusPosition—Which adjacent slot the status icon occupies.
iconTIcon—Explicit icon, overriding the one implied by status.
prependIconTIcon—Icon in the prepend (left) column.
appendIconTIcon—Icon in the append (right) column.
prependAvatarstring—Avatar image URL in the prepend column.
appendAvatarstring—Avatar image URL in the append column.

Colour ​

PropTypeDefaultDescription
colorTColor—Foreground / accent intent.
bgColorTColor—Background intent.

Because Alert binds useActive(props, 'modelValue'), useColorEffect returns no utility class while the alert is visible — the surface is painted by the inline colorStyles. Assert on getComputedStyle, not on .origam--color-*.

Border ​

PropTypeDefaultDescription
borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>—Border shorthand.
borderTop / borderRight / borderBottom / borderLeftboolean | number | string—Per-side width.
borderBlock / borderInlineboolean | number | string—Logical axis width.
borderColorstring—Border colour for every side.
borderTopColor / borderRightColor / borderBottomColor / borderLeftColorTColor—Per-side colour.
borderStylestring—solid, dashed, …

Rounded ​

PropTypeDefaultDescription
roundedboolean | number | string | TRounded | null—Radius shorthand.
roundedTopLeft / roundedTopRight / roundedBottomLeft / roundedBottomRightboolean | number | string—Per-corner radius.

Spacing ​

PropTypeDefaultDescription
paddingboolean | number | string—Padding shorthand.
paddingTop / paddingRight / paddingBottom / paddingLeftboolean | number | string—Per-side padding.
paddingBlock / paddingInlineboolean | number | string—Logical axis padding.
marginboolean | number | string—Margin shorthand.
marginTop / marginRight / marginBottom / marginLeftboolean | number | string—Per-side margin.
marginBlock / marginInlineboolean | number | string—Logical axis margin.

Dimension ​

PropTypeDefaultDescription
width / heightnumber | string—Fixed size. Bare numbers become px.
minWidth / minHeightnumber | string—Lower bound.
maxWidth / maxHeightnumber | string—Upper bound.

Layout & elevation ​

PropTypeDefaultDescription
densityTDensity'default'compact / default / comfortable.
elevationTElevation—Shadow rung (xs…xl). Never hardcode a shadow per instance.
positionTPosition—CSS positioning scheme.
top / right / bottom / leftnumber | string—Offsets, applied when position is set.
locationTAnchor—Anchor shorthand resolved by useLocation().
hoverboolean | IHoverStatefalseForces the hover surface on, or configures it explicitly. Without it the hover state follows mouseenter / mouseleave.

Typography ​

fontSize, fontWeight, letterSpacing and lineHeight target the __title BEM child — see Typography props above. fontFamily is not part of this component's props (project-level setting, see issue #501).

Identity ​

PropTypeDefaultDescription
tagstring'div'Root element.
idstring—Root id.
classstring | Array<string> | object—Merged into the root class list.
stylestring | Array<string> | object | StyleValue—Merged into the root style.

Emits ​

EventPayloadDescription
click:closeMouseEventClose button was clicked
update:modelValuebooleanAlert visibility changed
update:hoverbooleanHover state changed

Slots ​

SlotDescription
defaultAdditional content rendered below title + text
prependCustom content in the prepend (left) column
appendCustom content in the append (right) column
titleOverride the title span
textOverride the body text
closeOverride the close button entirely
wrapperFull layout override (replaces all inner structure)

Tokens ​

VariableDefaultUsed for
--origam-alert---background-color(unset)alert fill
--origam-alert---color(unset)alert text colour
--origam-alert---border-radius(unset)corner rounding
--origam-alert---border-width(unset)border thickness
--origam-alert---density0pxpadding density delta
--origam-alert---padding-block-start(unset)top padding
--origam-alert---padding-block-end(unset)bottom padding
--origam-alert---padding-inline-start(unset)left padding
--origam-alert---padding-inline-end(unset)right padding
--origam-alert__title---font-size(unset)title font size
--origam-alert__title---font-weight(unset)title font weight
--origam-alert--warning---bgorangewarning background
--origam-alert--success---bggreensuccess background
--origam-alert--info---bgblueinfo background
--origam-alert--danger---bgrederror/danger background