| Name |
Type |
Default value |
Description |
|---|
| ActionsTemplate |
RenderFragment<BitSnackBarItem>? |
null |
The content of the action area of every snack bar item, rendered under its body. An item that carries its own Actions renders that instead. |
| AutoDismiss |
bool |
false |
Whether or not automatically dismiss the snack bar. The countdown of an item is paused while the pointer or the keyboard focus is inside it, and a persistent item never takes part in it at all. |
| AutoDismissTime |
TimeSpan? |
null |
How long does it take to automatically dismiss the snack bar (default is 3 seconds). A single item can ask for a lifetime of its own through BitSnackBarItem.AutoDismissTime, and a value of zero or less turns the countdown off. |
| BodyTemplate |
RenderFragment<string>? |
null |
Used to customize how the content inside the body is rendered. |
| Classes |
BitSnackBarClassStyles? |
null |
Custom CSS classes for different parts of the snack bar. |
| ClearOnNavigation |
bool |
false |
Closes every snack bar item as soon as the app navigates somewhere else, so a notification about the page it was raised on does not outlive that page. |
| DismissAriaLabel |
string? |
null |
The accessible label of the dismiss button (default is "Close"). The button holds nothing but an icon, so without a label of its own a screen reader has nothing to announce it by. |
| DismissIcon |
BitIconInfo? |
null |
Gets or sets the icon of the dismiss button using custom CSS classes for external icon libraries. Takes precedence over DismissIconName when both are set. |
| DismissIconName |
string? |
null |
The icon name of the dismiss button from the built-in Fluent UI icons. If unset, default will be the Fluent UI Cancel icon. |
| DismissOnClick |
bool |
false |
Dismisses a snack bar item when anywhere inside it is clicked. Leave this off while the item holds interactive content the user is still filling in. |
| HideDismiss |
bool |
false |
Prevents rendering the dismiss button of every snack bar item. Unlike Persistent this only takes the button away: the items still count down, still answer the Escape key and still take part in DismissOnClick. |
| HideProgress |
bool |
false |
Prevents rendering the countdown progress bar of the auto-dismissing snack bars. |
| Hotkey |
string[]? |
null |
The keyboard shortcut that moves the focus to the snack bar region, as a list of KeyboardEvent.code values (the modifiers written as their property names, so ["KeyT", "altKey"] is Alt+T). A notification is at the end of the document and takes itself away again, so this is what makes the actions inside one operable from the keyboard at all. Off unless a shortcut is given; needs the bit BlazorUI script to be on the page. |
| Icon |
BitIconInfo? |
null |
The leading icon of every snack bar item using custom CSS classes for external icon libraries. Only rendered while ShowIcon is enabled, and takes precedence over IconName when both are set. |
| IconName |
string? |
null |
The name of the leading icon of every snack bar item from the built-in Fluent UI icons. Only rendered while ShowIcon is enabled. If unset, the icon of each item is selected automatically based on its color. |
| MaxItems |
int? |
null |
The maximum number of snack bar items to show at once, so a burst of notifications cannot grow into a wall that covers the page. What happens to the item that does not fit is up to OverflowBehavior. Unset (or zero and below) means no cap. |
| MaxWidth |
string? |
null |
The maximum width of the snack bar items. Any CSS length is accepted, and the stack never grows past the width of the screen whatever this says. Unset, an item is as wide as its longest line needs. |
| Multiline |
bool |
false |
Enables the multiline mode of both title and body. A single-line title or body that does not fit is cut off with an ellipsis and keeps its full text in a tooltip. |
| NewestOnTop |
bool |
false |
Puts the newest snack bar item at the top of the stack instead of the bottom. |
| Offset |
string? |
null |
The distance of the stack from the edges of the screen (default is 8px). Any CSS length is accepted, which is how a snack bar is kept clear of the chrome the app already has at that edge. |
| OnDismiss |
EventCallback<BitSnackBarItem> |
|
Callback for when any snack bar is dismissed, reporting the item that was dismissed. Its DismissReason tells what took it away. |
| OnItemClick |
EventCallback<BitSnackBarItem> |
|
Callback for when any snack bar item is clicked. |
| OnShow |
EventCallback<BitSnackBarItem> |
|
Callback for when a new snack bar item is shown. An item held back by the Queue overflow behavior reports this when it reaches the screen rather than when it was handed to Show. |
| OverflowBehavior |
BitSnackBarOverflowBehavior |
BitSnackBarOverflowBehavior.DismissOldest |
What happens to a new snack bar item that arrives while MaxItems is already reached: the oldest one is dismissed to make room for it, the new one is held back until a slot frees up, or the new one is dropped. |
| PauseOnHover |
bool |
true |
Pauses the auto-dismiss countdown while the pointer or the keyboard focus is inside a snack bar item. This is how the countdown meets WCAG 2.2.1 (Timing Adjustable) without a longer timeout. |
| PauseOnPageHidden |
bool |
false |
Pauses the auto-dismiss countdown of every snack bar item while the page is hidden, so a notification is not spent in a background tab. Needs the bit BlazorUI services to be registered (AddBitBlazorUIServices). |
| PauseOnWindowBlur |
bool |
false |
Pauses the auto-dismiss countdown of every snack bar item while the window does not have the focus. A window that another one is covering is not hidden, so PauseOnPageHidden alone lets a notification count down behind whatever is in front of it. Needs the bit BlazorUI services to be registered (AddBitBlazorUIServices). |
| Persistent |
bool |
false |
Makes the snack bar non-dismissible in UI and removes the dismiss button. A persistent snack bar also opts out of the auto-dismiss countdown and of the Escape key. To take the button away without also taking the countdown away, use HideDismiss instead. |
| Position |
BitSnackBarPosition? |
null |
The position of the snack bars to show (default is bottom right). |
| PreventDuplicates |
bool |
false |
Skips showing a new snack bar while an identical one (same title, body and color) is already on screen, returning the one that is already showing instead and starting its countdown over. |
| ReverseProgress |
bool |
false |
Draws the countdown progress bar depleting from full to empty instead of filling from empty to full, so it reads as the time the notification has left rather than as how far it has got through its lifetime. |
| Role |
string? |
null |
A custom ARIA role for every snack bar item, overriding the one its color implies. By default the colors that report a problem are announced as an alert and the rest as a status, and a role that is not a live one leaves the item unannounced. |
| ShowIcon |
bool |
false |
Renders a leading icon in each snack bar item, chosen from its color unless one is provided. |
| Size |
BitSize? |
null |
The size of the snack bar items. |
| Styles |
BitSnackBarClassStyles? |
null |
Custom CSS styles for different parts of the snack bar. |
| SwipeToDismiss |
bool |
false |
Lets a snack bar item be dragged out of the way with the pointer, in either inline direction, which is how a notification is thrown away on a touch screen. A persistent item is not swipeable. Needs the bit BlazorUI script to be on the page. |
| SwipeThreshold |
int |
50 |
How far a snack bar item has to be dragged before it is dismissed, in pixels. Only in effect while SwipeToDismiss is enabled; a drag that stops short of this springs the item back where it was. |
| Template |
RenderFragment<BitSnackBarItem>? |
null |
Used to fully customize how a snack bar item is rendered, taking the place of its header, body and actions. The countdown progress bar is still rendered under the template. |
| TitleTemplate |
RenderFragment<string>? |
null |
Used to customize how content inside the title is rendered. |
| TransitionDuration |
int |
200 |
The duration in milliseconds of the enter and exit animations of the snack bar items. A dismissed item is kept in the DOM for this long so its exit animation can play. Set it to zero to remove the item at once. |
| Variant |
BitVariant? |
null |
The visual variant of the snack bar items. |
| Name |
Type |
Default value |
Description |
|---|
| Items |
IReadOnlyList<BitSnackBarItem> |
[] |
The snack bar items that are currently showing, oldest first (or newest first with NewestOnTop). |
| PendingItems |
IReadOnlyList<BitSnackBarItem> |
[] |
The snack bar items that are waiting for a slot under the Queue overflow behavior, in the order they will be shown. |
| Info |
Task<BitSnackBarItem> Info(string title, string? body = "", bool persistent = false, TimeSpan? autoDismissTime = null) |
|
Shows a new snackbar with Info color. |
| Success |
Task<BitSnackBarItem> Success(string title, string? body = "", bool persistent = false, TimeSpan? autoDismissTime = null) |
|
Shows a new snackbar with Success color. |
| Warning |
Task<BitSnackBarItem> Warning(string title, string? body = "", bool persistent = false, TimeSpan? autoDismissTime = null) |
|
Shows a new snackbar with Warning color. |
| SevereWarning |
Task<BitSnackBarItem> SevereWarning(string title, string? body = "", bool persistent = false, TimeSpan? autoDismissTime = null) |
|
Shows a new snackbar with SevereWarning color. |
| Error |
Task<BitSnackBarItem> Error(string title, string? body = "", bool persistent = false, TimeSpan? autoDismissTime = null) |
|
Shows a new snackbar with Error color. |
| Show |
Task<BitSnackBarItem> Show(string title, string? body = "", BitColor color = BitColor.Info, string? cssClass = null, string? cssStyle = null, bool persistent = false, TimeSpan? autoDismissTime = null) |
|
Shows a new snackbar. |
| Show |
Task<BitSnackBarItem> Show(BitSnackBarItem item) |
|
Shows a new snackbar. Showing an item that is already showing (or already waiting in the queue) is a no-op that returns it unchanged, and so is showing a duplicate of one while PreventDuplicates is enabled - in which case the item that is already showing comes back instead, with its countdown started over. An item that does not fit under MaxItems is dealt with by OverflowBehavior. |
| Close |
Task Close(BitSnackBarItem item) |
|
Closes a snackbar item. The returned task completes once the item has left the DOM, which is after its exit animation has played. An item that is still waiting in the queue is taken out of it instead. |
| Clear |
Task Clear() |
|
Closes every snackbar item that is currently showing, and drops everything that was waiting in the queue. |
| Update |
Task Update(BitSnackBarItem item) |
|
Re-renders a snackbar item after its properties were changed, restarts its auto-dismiss countdown and announces its new text again. This is how a notification is turned into the report of what it was waiting for. |
| FocusAsync |
ValueTask FocusAsync() |
|
Moves the keyboard focus to the snack bar region, which is what puts the next Tab inside the notifications. This is what Hotkey does, offered on its own for an app with a shortcut registry of its own. |
| Pause |
Task Pause(BitSnackBarItem item) |
|
Pauses the auto-dismiss countdown of a snackbar item. This is a hold of its own rather than the same one the pointer takes, so it is not let go again by the pointer happening to leave the item - only Resume releases it. |
| Resume |
Task Resume(BitSnackBarItem item) |
|
Resumes the auto-dismiss countdown of a snackbar item that was paused. A countdown is held back for as long as any one reason to hold it back stands, so this does nothing while the pointer or the keyboard focus is still inside the item or the page is still hidden. |
| Name |
Type |
Default value |
Description |
|---|
| AriaLabel |
string? |
null |
Gets or sets the accessible label for the component, used by assistive technologies. |
| Class |
string? |
null |
Gets or sets the CSS class name(s) to apply to the rendered element. |
| Dir |
BitDir? |
null |
Gets or sets the text directionality for the component's content. |
| ForceAnimation |
bool |
false |
Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested. |
| HtmlAttributes |
Dictionary<string, object> |
new Dictionary<string, object>() |
Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters. |
| Id |
string? |
null |
Gets or sets the unique identifier for the component's root element. |
| IsEnabled |
bool |
true |
Gets or sets a value indicating whether the component is enabled and can respond to user interaction. |
| Style |
string? |
null |
Gets or sets the CSS style string to apply to the rendered element. |
| TabIndex |
string? |
null |
Gets or sets the tab order index for the component when navigating with the keyboard. |
| Visibility |
BitVisibility |
BitVisibility.Visible |
Gets or sets the visibility state (visible, hidden, or collapsed) of the component. |