# SbBanner
A prominent message bar for important announcements or alerts that spans the full width of its container. Supports multiple severity levels, custom actions, and dismissible behavior.
## Parameters
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| Title | string? | null | Banner title displayed prominently |
| Message | string? | null | Banner message text (used when ChildContent is not provided) |
| Severity | SbBannerSeverity | Info | Banner severity (Info, Success, Warning, Error) |
| Dismissible | bool | true | Whether the banner can be dismissed |
| Class | string? | null | Additional CSS classes |
## Events
| Event | Type | Description |
|-------|------|-------------|
| OnDismiss | EventCallback | Fired when the banner is dismissed |
## Templates / Slots
| Slot | Type | Description |
|------|------|-------------|
| ChildContent | RenderFragment? | Custom content for the banner message (takes precedence over Message) |
| Actions | RenderFragment? | Action buttons displayed at the bottom of the banner |
### Template Usage
#### Basic Content
```razor
This is custom content inside the banner.
```
#### With Actions
```razor
A new version is available. Would you like to update now?
LaterUpdate Now
```
## Methods
| Method | Return Type | Description |
|--------|-------------|-------------|
| Show() | void | Shows the banner after it has been dismissed |
## CSS Classes
- `sb-banner` - Base class
- `sb-banner--info` - Info severity
- `sb-banner--success` - Success severity
- `sb-banner--warning` - Warning severity
- `sb-banner--error` - Error severity
- `sb-banner__header` - Header row container
- `sb-banner__header-start` - Icon and title container
- `sb-banner__icon` - Icon container
- `sb-banner__title` - Title text
- `sb-banner__close` - Close button
- `sb-banner__content` - Content/message area
- `sb-banner__message` - Message text
- `sb-banner__actions` - Actions container
## Accessibility
- Uses `role="alert"` for important announcements
- Close button has `aria-label="Dismiss"`
## Examples
### Basic Banners
```razor
```
### Non-Dismissible Banner
```razor
```
### With Custom Content and Actions
```razor
We've added dark mode support! Try it out in your settings.
Maybe Later
Go to Settings
```
### Handling Dismiss
```razor
Show Banner Again
@code {
private SbBanner? bannerRef;
private void HandleDismiss()
{
Console.WriteLine("Banner was dismissed");
}
private void ShowBanner()
{
bannerRef?.Show();
}
}
```