# Toolbar

Give buttons, toggles, menus and fields one tab stop with arrow-key navigation.

Use a Toolbar to group the controls of an editor, a canvas or a table. Tab enters it once, and the arrow keys move between its buttons, toggles, menus and fields.

```angular-ts title="demo.ts"
import { Component } from "@angular/core"
import {
  LucideBold,
  LucideDynamicIcon,
  LucideItalic,
  LucideLink,
  LucideUnderline,
} from "@lucide/angular"
import { useLog } from "./log"
import { Toggle, ToggleIcon } from "@ui-sdk/angular/toggle"
import {
  Toolbar,
  ToolbarButton,
  ToolbarSeparator,
} from "@ui-sdk/angular/toolbar"

@Component({
  imports: [
    Toggle,
    ToggleIcon,
    Toolbar,
    ToolbarButton,
    ToolbarSeparator,
    LucideDynamicIcon,
    LucideLink,
  ],
  template: `
    <div uiToolbar aria-label="Formatting">
      @for (item of styles; track item.label) {
        <button
          uiToggle
          [aria-label]="item.label"
          (beforePressedChange)="
            log(item.label + ' ' + ($event.value ? 'on' : 'off'))
          "
        >
          <span uiToggleIcon>
            <svg [lucideIcon]="item.icon"></svg>
          </span>
        </button>
      }
      <div uiToolbarSeparator></div>
      <button
        uiToolbarButton
        aria-label="Insert link"
        (click)="log('Insert link')"
      >
        <svg lucideLink></svg>
      </button>
    </div>
  `,
})
class Example {
  readonly styles = [
    { label: "Bold", icon: LucideBold },
    { label: "Italic", icon: LucideItalic },
    { label: "Underline", icon: LucideUnderline },
  ]

  readonly log = useLog()
}

export { Example }
```

Tab into the toolbar, then use Left and Right to move between Bold, Italic, Underline and Insert link. Press Space to toggle the focused style. The console logs each change.

## Installation

```bash
npm install @ui-sdk/angular @ui-sdk/core
```

## Composition

Use the following composition to build Toolbar:

```text
uiToolbar
├── uiToolbarButton
├── uiToolbarSeparator
├── uiToolbarGroup
│   ├── uiToolbarButton
│   └── uiToolbarButton
├── uiToolbarLink
└── uiToolbarInput
```

Put buttons, links and fields straight inside the toolbar. `uiToolbarGroup` names a set of related items, and `uiToolbarSeparator` draws a line between sets. Toggles and toggle groups join the toolbar on their own, and menu and select triggers join through `uiToolbarButton`.

## Usage

Import the parts and put them together:

```ts
import { Component } from "@angular/core"
import {
  Toolbar,
  ToolbarButton,
  ToolbarSeparator,
} from "@ui-sdk/angular/toolbar"

@Component({
  selector: "app-example",
  imports: [Toolbar, ToolbarButton, ToolbarSeparator],
  template: `
    <div uiToolbar aria-label="Formatting">
      <button uiToolbarButton>Undo</button>
      <button uiToolbarButton>Redo</button>
      <div uiToolbarSeparator></div>
      <button uiToolbarButton>Insert Link</button>
    </div>
  `,
})
class Example {}

export { Example }
```

Name the toolbar with `aria-label`, and give every icon-only control its own.

## Toggle Groups

A [Toggle](/docs/angular/components/toggle) group inside a toolbar joins its navigation instead of adding another tab stop. Arrow keys move focus without pressing anything; Enter or Space presses the focused toggle.

```angular-ts title="toggle-group.ts"
import { Component } from "@angular/core"
import {
  LucideAlignCenter,
  LucideAlignLeft,
  LucideAlignRight,
  LucideDynamicIcon,
  LucideList,
  LucideListOrdered,
} from "@lucide/angular"
import { useLog } from "./log"
import { Toggle, ToggleGroup, ToggleIcon } from "@ui-sdk/angular/toggle"
import { Toolbar, ToolbarSeparator } from "@ui-sdk/angular/toolbar"

@Component({
  imports: [
    Toggle,
    ToggleGroup,
    ToggleIcon,
    Toolbar,
    ToolbarSeparator,
    LucideDynamicIcon,
  ],
  template: `
    <div uiToolbar aria-label="Paragraph">
      <div
        uiToggleGroup
        [defaultValue]="['left']"
        [deselectable]="false"
        aria-label="Alignment"
        (beforeValueChange)="log('Align ' + $event.value[0])"
      >
        @for (item of alignments; track item.value) {
          <button uiToggle [value]="item.value" [aria-label]="item.label">
            <span uiToggleIcon>
              <svg [lucideIcon]="item.icon"></svg>
            </span>
          </button>
        }
      </div>
      <div uiToolbarSeparator></div>
      <div
        uiToggleGroup
        aria-label="List"
        (beforeValueChange)="logList($event.value[0])"
      >
        @for (item of lists; track item.value) {
          <button uiToggle [value]="item.value" [aria-label]="item.label">
            <span uiToggleIcon>
              <svg [lucideIcon]="item.icon"></svg>
            </span>
          </button>
        }
      </div>
    </div>
  `,
})
class Example {
  readonly alignments = [
    { value: "left", label: "Align left", icon: LucideAlignLeft },
    { value: "center", label: "Align center", icon: LucideAlignCenter },
    { value: "right", label: "Align right", icon: LucideAlignRight },
  ]

  readonly lists = [
    { value: "bulleted", label: "Bulleted list", icon: LucideList },
    { value: "numbered", label: "Numbered list", icon: LucideListOrdered },
  ]

  readonly log = useLog()

  logList(value: string | undefined) {
    this.log(
      this.lists.find((list) => list.value === value)?.label ?? "No list"
    )
  }
}

export { Example }
```

Arrow from the alignment group to the list group, then press Space on Align center or Numbered list. The console logs each choice.

## Groups

Use `uiToolbarGroup` to name related controls. Set `disabled` on the group to disable them together; they stay focusable with `aria-disabled`.

```angular-ts title="group.ts"
import { Component } from "@angular/core"
import {
  LucideClipboard,
  LucideCopy,
  LucideDynamicIcon,
  LucideRedo,
  LucideScissors,
  LucideUndo,
} from "@lucide/angular"
import { useLog } from "./log"
import {
  Toolbar,
  ToolbarButton,
  ToolbarGroup,
  ToolbarSeparator,
} from "@ui-sdk/angular/toolbar"

@Component({
  imports: [
    Toolbar,
    ToolbarButton,
    ToolbarGroup,
    ToolbarSeparator,
    LucideDynamicIcon,
    LucideRedo,
    LucideUndo,
  ],
  template: `
    <div uiToolbar aria-label="Edit">
      <div uiToolbarGroup aria-label="Clipboard">
        @for (item of clipboard; track item.label) {
          <button
            uiToolbarButton
            [aria-label]="item.label"
            (click)="log(item.label)"
          >
            <svg [lucideIcon]="item.icon"></svg>
          </button>
        }
      </div>
      <div uiToolbarSeparator></div>
      <div uiToolbarGroup disabled aria-label="History">
        <button uiToolbarButton aria-label="Undo">
          <svg lucideUndo></svg>
        </button>
        <button uiToolbarButton aria-label="Redo">
          <svg lucideRedo></svg>
        </button>
      </div>
    </div>
  `,
})
class Example {
  readonly clipboard = [
    { label: "Cut", icon: LucideScissors },
    { label: "Copy", icon: LucideCopy },
    { label: "Paste", icon: LucideClipboard },
  ]

  readonly log = useLog()
}

export { Example }
```

Move through Cut, Copy and Paste into History with the arrow keys. Undo and Redo stay focusable but do nothing.

## Menus

Put `uiToolbarButton` on a [Menu](/docs/angular/components/menu) trigger. In a horizontal toolbar, Down opens the menu while Left and Right keep moving between toolbar items.

```angular-html
<ng-container uiMenu>
  <button uiMenuTrigger uiToolbarButton>Share</button>
  <div *uiMenuContent>…</div>
</ng-container>
```

```angular-ts title="menu.ts"
import { Component } from "@angular/core"
import { LucideChevronDown } from "@lucide/angular"
import { useLog } from "./log"
import { Menu, MenuContent, MenuItem, MenuTrigger } from "@ui-sdk/angular/menu"
import { Toolbar, ToolbarButton } from "@ui-sdk/angular/toolbar"

@Component({
  imports: [
    Menu,
    MenuContent,
    MenuItem,
    MenuTrigger,
    Toolbar,
    ToolbarButton,
    LucideChevronDown,
  ],
  template: `
    <div uiToolbar aria-label="Document">
      <button uiToolbarButton (click)="log('Saved')">Save</button>
      <ng-container uiMenu (action)="log('Shared by ' + $event.value)">
        <button uiMenuTrigger uiToolbarButton>
          Share
          <svg lucideChevronDown></svg>
        </button>
        <div *uiMenuContent>
          <div uiMenuItem value="email">Email</div>
          <div uiMenuItem value="link">Copy Link</div>
        </div>
      </ng-container>
      <button uiToolbarButton (click)="log('Printed')">Print</button>
    </div>
  `,
})
class Example {
  readonly log = useLog()
}

export { Example }
```

Focus Share and press Down, then choose Email or Copy Link. Escape closes the menu and returns focus to Share.

## Selects

A [Select](/docs/angular/components/select) trigger joins the same way. It keeps its select behavior while it takes part in the toolbar's focus order.

```angular-ts title="select.ts"
import { Component, computed, signal } from "@angular/core"
import {
  LucideCheck,
  LucideChevronsUpDown,
  LucideZoomIn,
  LucideZoomOut,
} from "@lucide/angular"
import { useLog } from "./log"
import {
  Select,
  SelectContent,
  SelectItem,
  SelectItemIndicator,
  SelectTrigger,
  SelectValue,
} from "@ui-sdk/angular/select"
import { Toolbar, ToolbarButton } from "@ui-sdk/angular/toolbar"

@Component({
  imports: [
    Select,
    SelectContent,
    SelectItem,
    SelectItemIndicator,
    SelectTrigger,
    SelectValue,
    Toolbar,
    ToolbarButton,
    LucideCheck,
    LucideChevronsUpDown,
    LucideZoomIn,
    LucideZoomOut,
  ],
  template: `
    <div uiToolbar aria-label="View">
      <button
        uiToolbarButton
        aria-label="Zoom out"
        [disabled]="index() === 0"
        (click)="change(zooms[index() - 1])"
      >
        <svg lucideZoomOut></svg>
      </button>
      <ng-container
        uiSelect
        [value]="zoom()"
        (beforeValueChange)="$event.value && change($event.value)"
      >
        <button uiSelectTrigger uiToolbarButton aria-label="Zoom">
          <span uiSelectValue></span>
          <svg lucideChevronsUpDown></svg>
        </button>
        <div *uiSelectContent>
          @for (zoom of zooms; track zoom) {
            <div uiSelectItem [value]="zoom">
              {{ zoom }}
              <span *uiSelectItemIndicator>
                <svg lucideCheck></svg>
              </span>
            </div>
          }
        </div>
      </ng-container>
      <button
        uiToolbarButton
        aria-label="Zoom in"
        [disabled]="index() === zooms.length - 1"
        (click)="change(zooms[index() + 1])"
      >
        <svg lucideZoomIn></svg>
      </button>
    </div>
  `,
})
class Example {
  readonly zooms = ["50%", "75%", "100%", "150%", "200%"]

  readonly log = useLog()

  readonly zoom = signal("100%")

  readonly index = computed(() => this.zooms.indexOf(this.zoom()))

  change(value: string) {
    this.zoom.set(value)
    this.log(`Zoom ${value}`)
  }
}

export { Example }
```

Open Zoom and choose a value, or step it with Zoom out and Zoom in. Each button turns off at the end of the range.

## Fields

Use `uiToolbarInput` for a text field, or put it on another field, like a [Number Input](/docs/angular/components/number-input) control. A field keeps Home, End and the arrow keys while they move its caret. At the matching end, with no text selected, an arrow moves to the next item.

Entering a field with an arrow puts its caret at the far end in that direction: press the same arrow again to leave, or the other arrow to edit. A number input keeps Up and Down for stepping its value.

```angular-ts title="input.ts"
import { Component } from "@angular/core"
import { LucideMinus, LucidePlus } from "@lucide/angular"
import {
  NumberInput,
  NumberInputControl,
  NumberInputDecrement,
  NumberInputGroup,
  NumberInputIncrement,
} from "@ui-sdk/angular/number-input"
import {
  Toolbar,
  ToolbarInput,
  ToolbarSeparator,
} from "@ui-sdk/angular/toolbar"

@Component({
  imports: [
    NumberInput,
    NumberInputControl,
    NumberInputDecrement,
    NumberInputGroup,
    NumberInputIncrement,
    Toolbar,
    ToolbarInput,
    ToolbarSeparator,
    LucideMinus,
    LucidePlus,
  ],
  template: `
    <div uiToolbar aria-label="Text">
      <div uiNumberInput [defaultValue]="14" [min]="8" [max]="72">
        <div uiNumberInputGroup>
          <button uiNumberInputDecrement aria-label="Decrease font size">
            <svg lucideMinus></svg>
          </button>
          <input uiNumberInputControl uiToolbarInput aria-label="Font size" />
          <button uiNumberInputIncrement aria-label="Increase font size">
            <svg lucidePlus></svg>
          </button>
        </div>
      </div>
      <div uiToolbarSeparator></div>
      <input uiToolbarInput aria-label="Find" placeholder="Find…" />
    </div>
  `,
})
class Example {}

export { Example }
```

Move into Font size and press Up or Down to change it. In Find, type a word, then move the caret to an edge before that arrow leaves the field.

## Links

`uiToolbarLink` joins the same focus order and keeps its link behavior. The demo handles a plain click itself and leaves modified clicks, like opening in a new tab, to the browser.

```angular-ts title="link.ts"
import { Component } from "@angular/core"
import { LucideCheck, LucideMessageSquare } from "@lucide/angular"
import { useLog } from "./log"
import {
  Toolbar,
  ToolbarButton,
  ToolbarLink,
  ToolbarSeparator,
} from "@ui-sdk/angular/toolbar"

@Component({
  imports: [
    Toolbar,
    ToolbarButton,
    ToolbarLink,
    ToolbarSeparator,
    LucideCheck,
    LucideMessageSquare,
  ],
  template: `
    <div uiToolbar aria-label="Pull request">
      <button uiToolbarButton aria-label="Approve" (click)="log('Approved')">
        <svg lucideCheck></svg>
      </button>
      <button uiToolbarButton aria-label="Comment" (click)="log('Comment')">
        <svg lucideMessageSquare></svg>
      </button>
      <div uiToolbarSeparator></div>
      <a uiToolbarLink href="#files" (click)="follow($event)">Files Changed</a>
      <a uiToolbarLink href="#checks" (click)="follow($event)">Checks</a>
    </div>
  `,
})
class Example {
  readonly log = useLog()

  follow(event: MouseEvent) {
    if (
      event.button !== 0 ||
      event.metaKey ||
      event.ctrlKey ||
      event.shiftKey ||
      event.altKey
    ) {
      return
    }
    event.preventDefault()
    this.log(`Opened ${(event.currentTarget as HTMLAnchorElement).textContent}`)
  }
}

export { Example }
```

Arrow to Files Changed and press Enter. The console logs the page it opened.

## Vertical

Set `orientation="vertical"` to move with Up and Down, like a canvas tool palette. Separators turn to run across the toolbar.

```angular-ts title="vertical.ts"
import { Component } from "@angular/core"
import {
  LucideDynamicIcon,
  LucideMousePointer2,
  LucidePencil,
  LucideSquare,
  LucideTrash2,
  LucideType,
} from "@lucide/angular"
import { useLog } from "./log"
import { Toggle, ToggleGroup, ToggleIcon } from "@ui-sdk/angular/toggle"
import {
  Toolbar,
  ToolbarButton,
  ToolbarSeparator,
} from "@ui-sdk/angular/toolbar"

@Component({
  imports: [
    Toggle,
    ToggleGroup,
    ToggleIcon,
    Toolbar,
    ToolbarButton,
    ToolbarSeparator,
    LucideDynamicIcon,
    LucideTrash2,
  ],
  template: `
    <div uiToolbar orientation="vertical" aria-label="Canvas">
      <div
        uiToggleGroup
        [defaultValue]="['select']"
        [deselectable]="false"
        orientation="vertical"
        aria-label="Tool"
        (beforeValueChange)="
          log(
            tools.find((tool) => tool.value === $event.value[0])?.label +
              ' tool'
          )
        "
      >
        @for (item of tools; track item.value) {
          <button uiToggle [value]="item.value" [aria-label]="item.label">
            <span uiToggleIcon>
              <svg [lucideIcon]="item.icon"></svg>
            </span>
          </button>
        }
      </div>
      <div uiToolbarSeparator></div>
      <button
        uiToolbarButton
        aria-label="Delete"
        (click)="log('Deleted selection')"
      >
        <svg lucideTrash2></svg>
      </button>
    </div>
  `,
})
class Example {
  readonly tools = [
    { value: "select", label: "Select", icon: LucideMousePointer2 },
    { value: "draw", label: "Draw", icon: LucidePencil },
    { value: "shape", label: "Shape", icon: LucideSquare },
    { value: "text", label: "Text", icon: LucideType },
  ]

  readonly log = useLog()
}

export { Example }
```

Use Up and Down to move between the tools and Delete. Space picks the focused tool.

## Disabled

A disabled item stays reachable with `aria-disabled`, so people can find it, but it ignores presses, including keys meant for another part on the same element. Set `focusableWhenDisabled` to `false` to skip it instead.

```angular-ts title="disabled.ts"
import { Component } from "@angular/core"
import { useLog } from "./log"
import { Toolbar, ToolbarButton } from "@ui-sdk/angular/toolbar"

@Component({
  imports: [Toolbar, ToolbarButton],
  template: `
    <div uiToolbar aria-label="Message">
      <button uiToolbarButton (click)="log('Reply')">Reply</button>
      <button uiToolbarButton disabled (click)="log('Archive')">Archive</button>
      <button
        uiToolbarButton
        disabled
        [focusableWhenDisabled]="false"
        (click)="log('Delete')"
      >
        Delete
      </button>
    </div>
  `,
})
class Example {
  readonly log = useLog()
}

export { Example }
```

Arrow from Reply to Archive, which is disabled but focusable. Delete is skipped. Only Reply logs a press.

Set `disabled` on the toolbar to disable every item. The toolbar keeps its tab stop, and its fields can't be edited.

```angular-html
<div uiToolbar disabled aria-label="Formatting">
  <button uiToolbarButton>Bold</button>
  <input uiToolbarInput aria-label="Find" />
</div>
```

## Loop

Arrow keys wrap from the last item to the first by default. Set `loop` to `false` to stop at the ends.

```angular-ts title="loop.ts"
import { Component } from "@angular/core"
import { useLog } from "./log"
import { Toolbar, ToolbarButton } from "@ui-sdk/angular/toolbar"

@Component({
  imports: [Toolbar, ToolbarButton],
  template: `
    <div uiToolbar [loop]="false" aria-label="Pages">
      @for (label of ["First", "Previous", "Next", "Last"]; track label) {
        <button uiToolbarButton (click)="log(\`\${label} page\`)">
          {{ label }}
        </button>
      }
    </div>
  `,
})
class Example {
  readonly log = useLog()
}

export { Example }
```

Focus Last and press Right. Focus stays there; Home still moves to First.

## Controller

Create a controller with `createToolbarController` and pass it as `controller`. Its `focus()` moves focus to the item focused last, like the Alt+F10 shortcut editors give their toolbars. Create one controller per toolbar.

```angular-ts title="controller.ts"
import { Component } from "@angular/core"
import {
  LucideBold,
  LucideDynamicIcon,
  LucideItalic,
  LucideLink,
} from "@lucide/angular"
import { useLog } from "./log"
import { useShortcut } from "@ui-sdk/angular/shortcuts"
import {
  createToolbarController,
  Toolbar,
  ToolbarButton,
} from "@ui-sdk/angular/toolbar"

@Component({
  imports: [Toolbar, ToolbarButton, LucideDynamicIcon],
  template: `
    <div data-slot="stack">
      <div data-slot="controls">
        <button type="button" (click)="toolbar.focus()">Focus Toolbar</button>
      </div>
      <div uiToolbar [controller]="toolbar" aria-label="Notes formatting">
        @for (item of actions; track item.label) {
          <button
            uiToolbarButton
            [aria-label]="item.label"
            (click)="log(item.label)"
          >
            <svg [lucideIcon]="item.icon"></svg>
          </button>
        }
      </div>
      <textarea
        aria-label="Notes"
        placeholder="Type, then press Alt+F10"
      ></textarea>
    </div>
  `,
})
class Example {
  readonly actions = [
    { label: "Bold", icon: LucideBold },
    { label: "Italic", icon: LucideItalic },
    { label: "Insert link", icon: LucideLink },
  ]

  readonly log = useLog()

  readonly toolbar = createToolbarController()

  constructor() {
    useShortcut("alt+f10", () => this.toolbar.focus(), { allowInInput: true })
  }
}

export { Example }
```

Type in Notes, then press Alt+F10 or choose Focus Toolbar. Press a toolbar button and the console logs it.

## Custom Rendering

Put `uiToolbarButton` or `uiToolbarInput` on the same element as another part to combine their behavior, like `<button uiSelectTrigger uiToolbarButton>`, as the menu, select and number input examples do. The element keeps the other part's `data-slot`, like `select-trigger`. [Parts and Composition](/docs/angular/parts-and-composition) explains more.

## Styling

Use `data-orientation` on the root for a row or a column, and on a separator for the way its line runs, across the toolbar. Use `data-disabled` to style unavailable items and groups. Toggles inside keep their own `data-pressed`.

Each part has a `data-slot`, such as `toolbar-button`, and its state attributes are listed under [Data Attributes](#data-attributes).

## Data Attributes

### Toolbar
`[data-slot="toolbar"]`

- `data-orientation` (`horizontal`, `vertical`): The toolbar's orientation. On a separator, which way the line runs: across the toolbar.
- `data-disabled`: Present when disabled, by the item itself, its group or the toolbar.

### ToolbarButton
`[data-slot="toolbar-button"]`

- `data-disabled`: Present when disabled, by the item itself, its group or the toolbar.
- `data-orientation` (`horizontal`, `vertical`): The toolbar's orientation. On a separator, which way the line runs: across the toolbar.

### ToolbarLink
`[data-slot="toolbar-link"]`

- `data-disabled`: Present when disabled, by the item itself, its group or the toolbar.
- `data-orientation` (`horizontal`, `vertical`): The toolbar's orientation. On a separator, which way the line runs: across the toolbar.

### ToolbarInput
`[data-slot="toolbar-input"]`

- `data-disabled`: Present when disabled, by the item itself, its group or the toolbar.
- `data-orientation` (`horizontal`, `vertical`): The toolbar's orientation. On a separator, which way the line runs: across the toolbar.

### ToolbarGroup
`[data-slot="toolbar-group"]`

- `data-disabled`: Present when disabled, by the item itself, its group or the toolbar.
- `data-orientation` (`horizontal`, `vertical`): The toolbar's orientation. On a separator, which way the line runs: across the toolbar.

### ToolbarSeparator
`[data-slot="toolbar-separator"]`

- `data-orientation` (`horizontal`, `vertical`): The toolbar's orientation. On a separator, which way the line runs: across the toolbar.

## API Reference

### Toolbar

- `orientation?` (`ToolbarOrientation`): Which arrow keys move between items: left and right, or up and down.
- `loop?` (`boolean`): Whether arrow keys wrap from the last item to the first.
- `disabled?` (`boolean`): Stops every item from being used. Items stay focusable with `aria-disabled`, so the toolbar keeps its tab stop and stays discoverable.
- `controller?` (`{ focus: () => void; }`): Focuses the toolbar from anywhere. Create one with `createToolbarController()`.
- `debug?` (`boolean`): Logs every state change with its reason to the console, in development builds.

### ToolbarButton

- `disabled?` (`boolean`): Stops the item from being used. It stays focusable with `aria-disabled`, so arrow keys still reach it and a tooltip can say why.
- `focusableWhenDisabled?` (`boolean`): Whether a disabled item stays reachable with arrow keys. Turn it off to skip it, natively disabled.

### ToolbarInput

- `disabled?` (`boolean`): Stops the item from being used. It stays focusable with `aria-disabled`, so arrow keys still reach it and a tooltip can say why.
- `focusableWhenDisabled?` (`boolean`): Whether a disabled item stays reachable with arrow keys. Turn it off to skip it, natively disabled.

### ToolbarGroup

- `disabled?` (`boolean`): Disables every item in the group. They stay focusable with `aria-disabled`.

`uiToolbarLink` and `uiToolbarSeparator` take no inputs of their own.

### State

What each part's `state()` signal holds on `uiToolbarButton` and `uiToolbarInput`:

- `disabled` (`boolean`): Whether the item is disabled, by itself, its group or the toolbar.
- `orientation` (`ToolbarOrientation`): The toolbar's `orientation` option: `"vertical"`, or `"horizontal"` for anything else.

On `uiToolbarLink`:

- `disabled` (`boolean`): Whether the link is disabled, by its group or the toolbar.
- `orientation` (`ToolbarOrientation`): The toolbar's `orientation` option: `"vertical"`, or `"horizontal"` for anything else.

On `uiToolbarSeparator`:

- `orientation` (`ToolbarOrientation`): Which way the line runs: across the toolbar, so vertical in a horizontal toolbar.

### Controller

- `focus()` (`() => void`): Moves focus to the item that holds the toolbar's tab stop: the one focused last, or the first.

## Accessibility

The toolbar follows the [WAI-ARIA toolbar pattern](https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/). The root has the `toolbar` role and `aria-orientation`, and separators have the `separator` role.

### Keyboard

The toolbar has one tab stop, a roving focus. Tab enters on the first enabled item, then returns to the item focused last. The next Tab leaves the toolbar.

| Key                        | Action                                          |
| -------------------------- | ----------------------------------------------- |
| `ArrowRight` / `ArrowLeft` | Move focus in a horizontal toolbar              |
| `ArrowDown` / `ArrowUp`    | Move focus in a vertical toolbar                |
| `Home` / `End`             | Focus the first or last item, except in a field |
| `Enter` / `Space`          | Activate a button or toggle, or open its popup  |

Controls keep the keys they use: Down opens a menu, and Up and Down step a number input. Moving focus never presses a toggle. In right-to-left text, Left and Right swap.

### Tested Behavior

Every line below is an automated test.

- The toolbar is named and has a horizontal orientation.
- Tab lands on the first item, and Tab again leaves the toolbar.
- Shift+Tab from after the toolbar lands on its tab stop.
- ArrowRight moves through every item, into toggle groups and out of fields.
- ArrowRight on the last item wraps to the first, and ArrowLeft back.
- Arrow keys never press a toggle, and Space and Enter do.
- Tab comes back to the item focused last.
- A toggle group in the toolbar is no tab stop of its own.
- A disabled button stays reachable, says it's disabled and does nothing.
- A button runs its action when pressed.
- A menu trigger rendered through a button opens with ArrowDown, and arrows still move past it.
- Choosing from a menu in the toolbar returns focus to its trigger.
- A text field keeps Home and End for its caret.
- Up and Down step a number field in the toolbar.
- Separators run across the toolbar.
- A group of buttons is named.
- A link in the toolbar follows its href with Enter.
- With loop off, arrows stop at the ends.
- A disabled toolbar keeps one tab stop, and every item says it's disabled.
- A toolbar button that renders a toggle is one item and one tab stop.

**Vertical**

- ArrowDown and ArrowUp move between items, and Left and Right don't.
- Separators run across a vertical toolbar.

**Disabled groups**

- Toggles and toggle groups in a disabled group are disabled.
- A link in a disabled group is disabled, and follows its href once enabled.
- Enabling a group enables the toggles and buttons in it.

Runs in React, Vue and web components.
