# SbAlert Displays important messages to users with contextual severity levels. Alerts can be dismissible and support various severities like info, success, warning, and danger. ## Parameters | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | Severity | SbAlertSeverity | Info | Alert severity level (Info, Success, Warning, Danger) | | Title | string? | null | Optional alert title displayed above the message | | Dismissible | bool | false | Whether the alert can be dismissed by the user | | Dense | bool | false | Reduces vertical padding for a more compact alert | | Class | string? | null | Additional CSS classes | | Style | string? | null | Inline styles | | AdditionalAttributes | Dictionary? | null | Additional HTML attributes | ## Events | Event | Type | Description | |-------|------|-------------| | OnDismiss | EventCallback | Fired when the alert is dismissed | ## Templates / Slots | Slot | Type | Description | |------|------|-------------| | ChildContent | RenderFragment | Main content/message of the alert | ### Template Usage ```razor This is the alert message content. ``` ## CSS Classes - `sb-alert` - Base class - `sb-alert--info` - Info severity - `sb-alert--success` - Success severity - `sb-alert--warning` - Warning severity - `sb-alert--danger` - Danger severity - `sb-alert--dense` - Compact variant - `sb-alert__icon` - Icon container - `sb-alert__content` - Content wrapper - `sb-alert__title` - Title text - `sb-alert__message` - Message text - `sb-alert__dismiss` - Dismiss button ## Accessibility - Uses `role="alert"` for danger severity (assertive) - Uses `role="status"` for other severities (polite) - Dismiss button has `aria-label="Dismiss"` ## Examples ### Basic Alerts ```razor This is an informational message. Operation completed successfully! Please review before proceeding. An error occurred. Please try again. ``` ### With Title ```razor Here are some details you should know about. ``` ### Dismissible Alert ```razor This alert can be closed by the user. @code { private void HandleDismiss() { // Handle dismissal } } ``` ### Dense Variant ```razor Compact alert with less vertical padding. ``` ### Full Example ```razor Your changes have been saved successfully. ```