Alert
Contextual feedback message with intent colors, optional title, dismiss button and icon slots.
Aperçu
Rendu de l’aperçu en cours…
successRendu de l’aperçu en cours…
dangerRendu de l’aperçu en cours…
warningRendu de l’aperçu en cours…
infoRendu de l’aperçu en cours…
closableStructure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<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
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et 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
Emplacements de contenu exposés par ce composant.
- #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
Événements émis par ce composant.
- @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
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.
- 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.
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.
- 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
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Rôles ARIA
Interactions clavier
| Touche | 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.
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.
- 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.
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.
Intent colors
Closable alert
Border accent