Skip to content

Toolbar

Move through a compact set of related actions and invoke the active tool.

Usage

Horizontal toolbar

Group inline text formatting actions in their natural horizontal order.

Group inline text formatting actions in their natural horizontal order.

Vertical toolbar

Stack canvas tools vertically beside an editing surface.

Stack canvas tools vertically beside an editing surface.

Controlled focus

Let the parent coordinate the active toolbar item without changing keyboard rules.

Let the parent coordinate the active toolbar item without changing keyboard rules.

API

Vue package: @sectile/vue/toolbar

Components
  • ToolbarRoot
  • ToolbarItem
  • ToolbarSeparator

Props

ToolbarRootProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

defaultValue

Initial value used when the component owns its state.

disabled

Whether interaction is unavailable.

disabledItems

Item values excluded from focus and selection.

items

Ordered item values managed by the component.

label

Accessible name announced for the control.

modelValue

Current value when state is controlled by the parent.

orientation

Axis used for layout and keyboard movement.

policies

Behavior policies that customize validation, movement, or selection.

ToolbarItemProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

disabled

Whether interaction is unavailable.

value

Current value exposed by this contract.

ToolbarPartProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

Slots

ToolbarRootSlotProps

disabled

Whether interaction is unavailable.

highlightedValue

Value currently highlighted for interaction.

orientation

Current layout and movement axis.

ToolbarItemSlotProps

disabled

Whether interaction is unavailable.

highlighted

Whether this item is highlighted for interaction.

value

Current value exposed by this contract.

Events

ToolbarRoot

invoke

Emitted when the current action is invoked.

update:modelValue

Emitted when the component requests a new controlled value.

Other types

ToolbarValueChangeHandler

ts
type ToolbarValueChangeHandler = (value: string | null) => void

ToolbarInvokeHandler

ts
type ToolbarInvokeHandler = (value: string) => void

Parts

Shared scope: [data-scope="toolbar"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
root[data-part="root"]Defines the component boundary and owns its composed parts.
item[data-part="item"]Represents one selectable or actionable item.
separator[data-part="separator"]Separates related groups without becoming an action.

Keyboard interaction

KeyBehavior
Arrow keysMove between toolbar items in the configured orientation.
Home / EndMove to the first or last enabled item.
Enter / SpaceInvoke the focused tool.

Accessibility

The labeled toolbar uses one roving tab stop and keeps separators out of the focus order.

See the corresponding WAI-ARIA pattern for the host accessibility contract.

Released under the MIT License.