DwsToolbar
A bar of controls with one Tab stop and arrow-key movement between its items. With Overflow=MoreButton the items that do not fit are opened from a more DwsButton (44 px on a touch screen).
API Reference — DwsToolbar API Reference — DwsToolbarItemBasic
A horizontal toolbar with plain (unwrapped) content. Tab enters it; Left/Right, Home and End move between its controls (Up/Down when vertical).
Show Code
Toolbar.razor
<DwsToolbar Name='ToolbarDemo_Toolbar01'>
<DwsButton Name='ToolbarDemo_Button01' Appearance='DwsAppearance.Icon' ButtonSize='DwsSize.Large' Icon='@Icons.Solid.List' Tooltip='Menu' />
<DwsSpacer Name='ToolbarDemo_Spacer01' Orientation='DwsLayoutOrientation.Horizontal' UseFlexGrow='true' />
<DwsButton Name='ToolbarDemo_Button02' Appearance='DwsAppearance.Icon' ButtonSize='DwsSize.Large' Icon='@Icons.Solid.User' Tooltip='Account' />
<DwsButton Name='ToolbarDemo_Button03' Appearance='DwsAppearance.Icon' ButtonSize='DwsSize.Large' Icon='@Icons.BS.ThreeDotsVertical' Tooltip='More' />
</DwsToolbar>
Vertical toolbar
Orientation=Vertical lays the toolbar out as a rail; Up/Down move between its controls.
Show Code
Toolbar.razor
<DwsToolbar Name='ToolbarDemo_Toolbar02' Orientation='DwsLayoutOrientation.Vertical'>
<DwsButton Name='ToolbarDemo_Button04' Appearance='DwsAppearance.Icon' ButtonSize='DwsSize.Large' Icon='@Icons.Solid.House' Tooltip='Home' />
<DwsButton Name='ToolbarDemo_Button05' Appearance='DwsAppearance.Icon' ButtonSize='DwsSize.Large' Icon='@Icons.Solid.Gear' Tooltip='Settings' />
<DwsButton Name='ToolbarDemo_Button06' Appearance='DwsAppearance.Icon' ButtonSize='DwsSize.Large' Icon='@Icons.Solid.User' Tooltip='Account' />
</DwsToolbar>
Theme color
Color applies a theme color to the toolbar through its CSS variable.
Show Code
Toolbar.razor
<DwsToolbar Name='ToolbarDemo_ToolbarColor' Color='DwsColor.Accent'>
<DwsButton Name='ToolbarDemo_ColorButton01' Appearance='DwsAppearance.Icon' ButtonSize='DwsSize.Large' Icon='@Icons.Solid.House' Tooltip='Home' />
<DwsButton Name='ToolbarDemo_ColorButton02' Appearance='DwsAppearance.Icon' ButtonSize='DwsSize.Large' Icon='@Icons.Solid.Gear' Tooltip='Settings' />
<DwsButton Name='ToolbarDemo_ColorButton03' Appearance='DwsAppearance.Icon' ButtonSize='DwsSize.Large' Icon='@Icons.Solid.User' Tooltip='Account' />
</DwsToolbar>
Hiding items below a breakpoint
HideBelowBreakpoint hides a DwsToolbarItem once the viewport drops below the given breakpoint - here the share button below SM.
The share button hides once the viewport drops below the SM breakpoint.
Show Code
Toolbar.razor
<DwsToolbar Name='ToolbarDemo_ToolbarBreakpoint'>
<DwsToolbarItem Name='ToolbarDemo_BreakpointItem01'>
<DwsButton Name='ToolbarDemo_BreakpointButton01' Appearance='DwsAppearance.Icon' ButtonSize='DwsSize.Large' Icon='@Icons.Solid.FloppyDisk' Tooltip='Save' />
</DwsToolbarItem>
<DwsToolbarItem Name='ToolbarDemo_Item03' HideBelowBreakpoint='DwsVisibilityBreakpoint.SM'>
<DwsButton Name='ToolbarDemo_Button09' Appearance='DwsAppearance.Icon' ButtonSize='DwsSize.Large' Icon='@Icons.Solid.Share' Tooltip='Share' />
</DwsToolbarItem>
</DwsToolbar>
Interface-Description
| Name | Typ | Parameters | Description |
|---|---|---|---|
| OpenOverflowAsync | Task | bool focusFirstItem | Opens the overflow panel. |
| CloseOverflowAsync | Task | Closes the overflow panel. | |
| GetItems | IEnumerable<DwsToolbarItem> | Returns all registered items, in their current display order. | |
| MoveItem | void | string name, int newIndex | Moves the named item to newIndex by reassigning flex order on every registered item. |
| MoveItemUp | void | string name | Swaps the named item with the item immediately before it. |
| MoveItemDown | void | string name | Swaps the named item with the item immediately after it. |
| Name | Typ | Default | Description |
|---|---|---|---|
| ChildContent | RenderFragment? | null | Toolbar content: plain markup, or one or more DwsToolbarItem components. |
| Dense | bool | false | Uses compact padding/height. |
| DisableGutters | bool | false | Disables the toolbar's edge padding. |
| Orientation | DwsLayoutOrientation | Horizontal | Lays the toolbar out as a horizontal bar or a vertical rail. |
| Color | DwsColor | Undefined | Theme color applied via CSS variable. |
| AnimationSpeed | DwsAnimationSpeed | Normal | Transition duration used for item hover/press affordances and reordering. |
| AriaLabel | string? | null | Overrides the toolbar's accessible label. |
| Overflow | DwsToolbarOverflow | None | What happens to items that do not fit a horizontal toolbar: None leaves the layout alone; MoreButton hides them (they leave the Tab order) and shows a button at the end of the bar that opens them as a panel below it. Needs an interactive render mode; ignored for a vertical toolbar. |
| OverflowIcon | string | Icons.BS.ThreeDots | Icon class of the "more" button - a DwsButton (icon appearance, selection haptic, 44 px on a touch screen) at the end of the bar. |
| OverflowAriaLabel | string? | null | Accessible name and tooltip of the "more" button; the localized default is "More tools". |
| OverflowOpen | bool | false | Whether the panel with the items that did not fit is open. Supports @bind-OverflowOpen. |
| Name | Typ | Description |
|---|---|---|
| OverflowOpenChanged | EventCallback<bool> | Fired when the overflow panel opens or closes (button, Escape, a click outside, the focus leaving, or everything fitting again). |
| OnToolbarClick | EventCallback<MouseEventArgs> | Fired on any click within the toolbar. |
| OnItemClick | EventCallback<DwsToolbarItem> | Fired when a registered DwsToolbarItem is clicked. Interactive children like DwsButton stop click propagation by default - set OnClickPropagation="true" on them for this to fire. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Element | ElementReference | The associated web component. May be null if accessed before the component is rendered. | |
| ComponentGuid | Guid | Unique identifier for the component. | |
| TypeString | string | The name of the component type, obtained from reflection. | |
| Authorized_RegisterEnabled | bool | false | Indicates whether this component is enabled through a permission registry. |
| Authorized_RegisterSelected | bool | false | Indicates whether this component is selected in permission selection mode. |
| GetInitializedState | bool | false | Returns whether the component is initialized. |
| GetRenderModeState | DwsRenderMode | Returns the current render mode. | |
| GetComponentState | DwsComponentStateType | Returns the current component state. | |
| GetIsInteractiveState | bool | false | Returns whether the component is interactive. |
| GetIsPrerenderingState | bool | false | Returns whether the component is prerendering. |
| GetComponentLoadingState | bool | false | Returns whether the component is loading. |
| IsFormBusy | bool | false | Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState). |
| Name | Typ | Parameters | Description |
|---|---|---|---|
| DebugInfo | void | Logs debug information about the component. | |
| UpdateState | void | Updates the component's state and triggers StateHasChanged. | |
| UpdateStateAsync | Task | Asynchronously updates the component's state and triggers StateHasChanged. | |
| Dispose | void | Disposes the component and releases resources. | |
| FocusAsync | ValueTask | bool containedInScrollableList | Sets focus to the component's element. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Name | string | Required unique identifier for the component within its container. | |
| Visible | bool | true | Determines if the component is visible in the UI. |
| Disabled | bool | false | Disables the form control, ensuring it doesn't participate in form submission. |
| ComponentNameSpace | string | The namespace for permission-based access control. | |
| PermissionKey | string? | null | A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins. |
| Class | string | Optional CSS class names. | |
| Style | string | Optional in-line styles. | |
| Tag | object | An optional user-defined object to store any additional data with the component. | |
| BackReference | DwsReference | A reference to the enclosing component. | |
| ID | string | The HTML ID attribute for the component. | |
| AdditionalAttributes | Dictionary<string, object> | Additional HTML attributes for the component's root element. | |
| IgnorePermissionChecks | bool | false | Bypasses all permission checks for this component. |
| IgnorePermissionSelection | bool | false | Ignore permission selection mode for this component. |
| IgnoreFormBusy | bool | false | Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it. |
| Name | Typ | Description |
|---|---|---|
| OnInitializedCallbackStarted | EventCallback | Callback when OnInitialized starts. |
| OnInitializedCallback | EventCallback | Callback during OnInitialized. |
| OnInitializedCallbackCompleted | EventCallback | Callback when OnInitialized completes. |
| OnInitializedAsyncCallbackStarted | EventCallback | Callback when OnInitializedAsync starts. |
| OnInitializedAsyncCallback | EventCallback | Callback during OnInitializedAsync. |
| OnInitializedAsyncCallbackCompleted | EventCallback | Callback when OnInitializedAsync completes. |
| OnIsComponentLoadingChanged | EventCallback<bool> | Callback when IsComponentLoading changes. |
| OnCurrentRenderModeChanged | EventCallback<DwsRenderMode> | Callback when CurrentRenderMode changes. |
| OnComponentStateChanged | EventCallback<DwsComponentStateType> | Callback when ComponentState changes. |
Interface-Description
| Name | Typ | Default | Description |
|---|---|---|---|
| ChildContent | RenderFragment? | null | The item's content. |
| Order | int? | null | Flex order among the parent toolbar's registered items; document order is used when unset. |
| HideBelowBreakpoint | DwsVisibilityBreakpoint? | null | Hides this item once the viewport shrinks below the given breakpoint. |
| Name | Typ | Description |
|---|---|---|
| OnClick | EventCallback<MouseEventArgs> | Fired when this item is clicked, before the parent toolbar's OnItemClick. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Element | ElementReference | The associated web component. May be null if accessed before the component is rendered. | |
| ComponentGuid | Guid | Unique identifier for the component. | |
| TypeString | string | The name of the component type, obtained from reflection. | |
| Authorized_RegisterEnabled | bool | false | Indicates whether this component is enabled through a permission registry. |
| Authorized_RegisterSelected | bool | false | Indicates whether this component is selected in permission selection mode. |
| GetInitializedState | bool | false | Returns whether the component is initialized. |
| GetRenderModeState | DwsRenderMode | Returns the current render mode. | |
| GetComponentState | DwsComponentStateType | Returns the current component state. | |
| GetIsInteractiveState | bool | false | Returns whether the component is interactive. |
| GetIsPrerenderingState | bool | false | Returns whether the component is prerendering. |
| GetComponentLoadingState | bool | false | Returns whether the component is loading. |
| IsFormBusy | bool | false | Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState). |
| Name | Typ | Parameters | Description |
|---|---|---|---|
| DebugInfo | void | Logs debug information about the component. | |
| UpdateState | void | Updates the component's state and triggers StateHasChanged. | |
| UpdateStateAsync | Task | Asynchronously updates the component's state and triggers StateHasChanged. | |
| Dispose | void | Disposes the component and releases resources. | |
| FocusAsync | ValueTask | bool containedInScrollableList | Sets focus to the component's element. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Name | string | Required unique identifier for the component within its container. | |
| Visible | bool | true | Determines if the component is visible in the UI. |
| Disabled | bool | false | Disables the form control, ensuring it doesn't participate in form submission. |
| ComponentNameSpace | string | The namespace for permission-based access control. | |
| PermissionKey | string? | null | A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins. |
| Class | string | Optional CSS class names. | |
| Style | string | Optional in-line styles. | |
| Tag | object | An optional user-defined object to store any additional data with the component. | |
| BackReference | DwsReference | A reference to the enclosing component. | |
| ID | string | The HTML ID attribute for the component. | |
| AdditionalAttributes | Dictionary<string, object> | Additional HTML attributes for the component's root element. | |
| IgnorePermissionChecks | bool | false | Bypasses all permission checks for this component. |
| IgnorePermissionSelection | bool | false | Ignore permission selection mode for this component. |
| IgnoreFormBusy | bool | false | Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it. |
| Name | Typ | Description |
|---|---|---|
| OnInitializedCallbackStarted | EventCallback | Callback when OnInitialized starts. |
| OnInitializedCallback | EventCallback | Callback during OnInitialized. |
| OnInitializedCallbackCompleted | EventCallback | Callback when OnInitialized completes. |
| OnInitializedAsyncCallbackStarted | EventCallback | Callback when OnInitializedAsync starts. |
| OnInitializedAsyncCallback | EventCallback | Callback during OnInitializedAsync. |
| OnInitializedAsyncCallbackCompleted | EventCallback | Callback when OnInitializedAsync completes. |
| OnIsComponentLoadingChanged | EventCallback<bool> | Callback when IsComponentLoading changes. |
| OnCurrentRenderModeChanged | EventCallback<DwsRenderMode> | Callback when CurrentRenderMode changes. |
| OnComponentStateChanged | EventCallback<DwsComponentStateType> | Callback when ComponentState changes. |
