Toolbar
A Duostrap command toolbar with classic gradient button variants, sizes, roving keyboard focus, and cross-axis separators.
Duostrap Toolbar preserves classic gradient button surfaces, pixel-accurate borders, and inset press shadows inside a single-Tab roving-focus container.
Preview
Section titled “Preview”<wc-duostrap-toolbar-root a11y-label="Document actions">
<wc-duostrap-toolbar-button value="undo">
Undo
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-button value="redo">
Redo
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-separator></wc-duostrap-toolbar-separator>
<wc-duostrap-toolbar-button value="cut">
Cut
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-button value="copy">
Copy
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-button value="paste" disabled>
Paste
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-separator></wc-duostrap-toolbar-separator>
<wc-duostrap-toolbar-button value="save" variant="primary">
Save
</wc-duostrap-toolbar-button>
</wc-duostrap-toolbar-root>Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases. Import the prototypes directly from @proto.ui/prototypes-duostrap/toolbar and adapt them for your target framework:
import { toolbarRoot, toolbarButton, toolbarSeparator,} from '@proto.ui/prototypes-duostrap/toolbar';import { BootstrapToolbarRoot, BootstrapToolbarButton, BootstrapToolbarSeparator,} from '../proto-ui/components/react';
export function EditorToolbar() { return ( <BootstrapToolbarRoot a11yLabel="Document actions"> <BootstrapToolbarButton value="undo">Undo</BootstrapToolbarButton> <BootstrapToolbarButton value="redo">Redo</BootstrapToolbarButton> <BootstrapToolbarSeparator /> <BootstrapToolbarButton value="save" variant="primary"> Save </BootstrapToolbarButton> </BootstrapToolbarRoot> );}Compose Root, Button, and Separator:
- Classic Bootstrap surface:
Buttonkeeps the v2.3.2 top-to-bottom gradients, hover background shift, and inset pressed shadow while suppressing duplicate focus outlines with a single clear focus ring. - Roving keyboard focus: Only one enabled button participates in the page
Taborder; arrow keys navigate commands and wrap whenloopis enabled (default). - Cross-axis dividers:
Separatorautomatically switches between a 1px vertical or horizontal divider based onRoot’s orientation.
Examples
Section titled “Examples”Classic Variants and Sizes
Section titled “Classic Variants and Sizes”Supports Duostrap’s default, primary, success, info, warning, danger, and inverse button palettes along with default, small, and mini sizing.
<wc-duostrap-toolbar-root a11y-label="Classic Bootstrap variants">
<wc-duostrap-toolbar-button value="default" variant="default">
Default
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-button value="primary" variant="primary">
Primary
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-button value="success" variant="success">
Success
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-separator></wc-duostrap-toolbar-separator>
<wc-duostrap-toolbar-button value="warning" variant="warning">
Warning
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-button value="danger" variant="danger">
Danger
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-button
value="inverse"
variant="inverse"
size="small"
>
Small
</wc-duostrap-toolbar-button>
</wc-duostrap-toolbar-root>Vertical Orientation
Section titled “Vertical Orientation”Setting orientation="vertical" stretches buttons into a stacked column with horizontal 1px dividers and Up/Down arrow navigation.
<wc-duostrap-toolbar-root
orientation="vertical"
a11y-label="Vertical command bar"
>
<wc-duostrap-toolbar-button value="align-left">
Align Left
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-button value="align-center">
Align Center
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-separator></wc-duostrap-toolbar-separator>
<wc-duostrap-toolbar-button value="indent">
Indent
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-button value="outdent">
Outdent
</wc-duostrap-toolbar-button>
</wc-duostrap-toolbar-root>Disabled and Non-Looping Navigation
Section titled “Disabled and Non-Looping Navigation”Disable the entire bar via Root.disabled={true}, or set loop={false} for bounded arrow-key navigation that skips disabled commands.
<div class="grid justify-items-center gap-4">
<wc-duostrap-toolbar-root disabled a11y-label="Read-only actions">
<wc-duostrap-toolbar-button value="undo">
Undo
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-button value="redo">
Redo
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-separator></wc-duostrap-toolbar-separator>
<wc-duostrap-toolbar-button value="save" variant="primary">
Save
</wc-duostrap-toolbar-button>
</wc-duostrap-toolbar-root>
<wc-duostrap-toolbar-root
loop="false"
a11y-label="Bounded actions"
>
<wc-duostrap-toolbar-button value="back">
Back
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-button value="forward" disabled>
Forward
</wc-duostrap-toolbar-button>
<wc-duostrap-toolbar-button value="reload">
Reload
</wc-duostrap-toolbar-button>
</wc-duostrap-toolbar-root>
</div>| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | false | Disables all command buttons in the toolbar |
orientation | 'horizontal' 'vertical' | 'horizontal' | Layout direction and arrow-key navigation axis |
loop | boolean | true | Wraps arrow-key focus between the first and last enabled commands |
a11yLabel | string | '' | Accessible name applied to the toolbar container |
Button
Section titled “Button”| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'default' 'primary' 'warning' 'danger' 'success' 'info' 'inverse' | 'default' | Classic Duostrap button color recipe |
size | 'default' 'small' 'mini' | 'default' | Pixel-accurate Duostrap button size |
value | string | '' | Command identifier emitted in the action event detail |
disabled | boolean | false | Disables this command with flat dimmed styling |
Separator and Events
Section titled “Separator and Events”- Separator: Takes no additional props and renders a 1px cross-axis divider automatically.
- Events and exposes:
Buttonemitsaction({ value: string }) on activation.Rootexposesdisabled,focusFirst(),focusLast(), andsetCurrent(id);Buttonexposesdisabled,focused,focusVisible, andfocusSelf(options).