Skip to main content

Toolbar

A row of controls that act on one surface.

… Read only … Run query
<mm-toolbar label="Query editor" dense>
<mm-select label="Source" hide-label value="snowflake-prod">…</mm-select>
<mm-status-pill status="neutral" icon="lock">Read only</mm-status-pill>
<mm-toolbar-separator></mm-toolbar-separator>
<mm-select label="Row limit" hide-label value="1000">…</mm-select>
<mm-button slot="end" variant="primary" icon="play-arrow">Run query</mm-button>
</mm-toolbar>

Guidance​

Toolbars group the controls that act on one surface, such as the query editor's source select, "Read only" status, row limit and Run query. They are chrome, so they stay quieter than the content they frame: no fill, no border, controls separated by space-2 and hairline separators.

Keyboard follows the WAI-ARIA toolbar pattern (https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/): the toolbar is one tab stop; Left and Right (Up and Down when vertical) move between controls, flipped in right-to-left, and Home and End go to the first and last. Focus returns to the last control used. Controls that use arrow keys themselves keep them: text fields keep Left, Right, Home and End for the caret, an mm-select opens on Home and End, and an mm-segmented-control moves its own selection with arrows, so place a segmented control at either end of a toolbar where you can. Disabled controls are skipped.

Put controls in the default slot (start) and the end slot; the gap between them flexes. dense sets 30px controls through --mm-control. label is required: it names the toolbar.

Properties​

PropertyAttributeTypeDefaultDescription
labellabelstring''Accessible name, such as "Query editor". Required.
orientationorientation'horizontal' | 'vertical''horizontal'horizontal (default) or vertical.
densedensebooleanfalse30px controls.
itemsHTMLElement[]The controls the toolbar moves between, in order.

Slots​

SlotDescription
DefaultControls at the start.
endControls at the end, such as the primary action.

CSS parts​

PartDescription
startThe start group.
endThe end group.

Examples​

Every state of mm-toolbar in Storybook, with keyboard and screen reader tests.