Alert API
Full surface of oge-alert, its [ogeAlertActions] / [ogeAlertIcon] slots and the config provider.
Properties Methods Events Types
OgeAlert
oge-alertProperties 8
| Name | Type | Default | Description |
|---|---|---|---|
severity | 'info' | 'success' | 'warning' | 'error' | undefined | config ?? 'info' | Meaning of the message — the colour, the glyph, the visually hidden prefix and (with live: auto) the role: error / warning are role="alert", info / success role="status". |
title | string | undefined | — | Bold first line above the message; the severity prefix moves into it. |
stylingMode | 'soft' | 'outlined' | 'filled' | undefined | config ?? 'soft' | soft is a tinted surface with a severity rail, outlined a coloured frame, filled the solid severity colour with --oge-severity-contrast text. |
dismissible | boolean | false | Renders a real dismiss button (name from the dismiss message) that runs the cancelable close. When the alert held focus, focus moves to the next tabbable element (ogeAlertFocusAfterClose). |
live | 'auto' | 'polite' | 'assertive' | 'off' | 'auto' | auto derives alert / status from the severity, assertive / polite force one, off renders no role (a permanent note). The role stays while the alert is hidden, so showing it again is announced (ogeAlertRole). |
showIcon | boolean | true | Shows the severity glyph (or the projected [ogeAlertIcon]); false drops the icon column. |
ariaLabel | string | undefined | — | Accessible name of the live region — only written while the alert has a role. |
visible | boolean (model) | true | Whether the alert is shown — two-way. false renders nothing and sets hidden on the host. |
Methods 2
| Name | Type | Description |
|---|---|---|
show() | () => void | Shows the alert again. |
close() | () => void | Runs the cancelable close (closing → closed), as the dismiss button does. |
Events 3
| Name | Type | Description |
|---|---|---|
visibleChange | boolean | The banana half of [(visible)]. |
closing | OgeAlertClosingEvent | Cancelable: the alert is about to close. Set cancel to keep it. |
closed | OgeAlertClosedEvent | The alert closed (visible is now false). |
Types 7
| Name | Type | Description |
|---|---|---|
OgeAlertActions | directive [ogeAlertActions] | Marks a row of real controls rendered under the message (in the Tab order). |
OgeAlertIcon | directive [ogeAlertIcon] | Replaces the default glyph; rendered inside an aria-hidden wrapper. |
OgeAlertSeverity | 'info' | 'success' | 'warning' | 'error' | Severity vocabulary. |
OgeAlertStylingMode | 'soft' | 'outlined' | 'filled' | Surface presets. |
OgeAlertLive | 'auto' | 'polite' | 'assertive' | 'off' | Live-region behaviour. |
OgeAlertClosingEvent | { event?: Event; cancel: boolean } | Payload of closing. |
OgeAlertClosedEvent | { event?: Event } | Payload of closed. |
Configuration
Properties 2
provideOgeAlertConfig()
| Name | Type | Description |
|---|---|---|
messages | OgeAlertMessages | Every user-facing string: dismiss (default Dismiss) and the visually hidden severity prefixes info / success / warning / error (default Information, Success, Warning, Error). Translated in every @oge-ui/locales pack (layout.alert). |
severity / stylingMode | — | Defaults for the matching inputs. Pass a function for a live config. |
Types 7
| Name | Type | Description |
|---|---|---|
provideOgeAlertConfig | (config: OgeAlertConfigInput | (() => OgeAlertConfigInput)) => Provider | Application- or component-scoped defaults; a function makes the config live. |
OGE_ALERT_CONFIG | InjectionToken<OgeAlertConfig> | The resolved config the alert injects. |
OGE_DEFAULT_ALERT_CONFIG | OgeAlertConfig | The defaults (from @oge-ui/behavior). |
OGE_DEFAULT_ALERT_MESSAGES | OgeAlertMessages | The English catalog. |
OgeAlertConfig | { messages: OgeAlertMessages; severity?; stylingMode? } | Resolved config shape. |
OgeAlertConfigInput | Partial<OgeAlertConfig> with partial messages | What the provider accepts. |
OgeAlertMessages | { dismiss; info; success; warning; error } | The alert catalog. |