j3w1 / theme

j3w1 / theme4.0.0

j3w1 / command

  • SPEC Overview
  • SPEC Foundations
  • SPEC Components
  • SPEC Patterns
  • SPEC Tokens
  • SPEC Tools
  • SPEC Workbench
  • SPEC Form builder
  • SPEC Task kit
  • SPEC Recipes
  • SPEC Figma bridge
  • SPEC Report an issue
  • SPEC Implement
  • SPEC For agents
  • SPEC Ports
  • SPEC Releases
  • SPEC Specification
  • DEMO Vue application demo

Toolbar

A row of related controls under one tab stop with arrow-key movement; ghost buttons, a vertical separator, and a "more" button when the row overflows.

stable · light DOM · 4.0.0. Light DOM retains static content, native semantics, label relationships and host composition without duplicating controls.

Live variants

default

Markup
<j3w1-toolbar id="example-toolbar-default"><div class="toolbar" role="toolbar" aria-label="Editor" aria-orientation="horizontal">
  <button class="toolbar-button" type="button" tabindex="0">Undo</button>
  <button class="toolbar-button" type="button" tabindex="-1">Redo</button>
  <div class="toolbar-separator" role="separator" aria-orientation="vertical"></div>
  <button class="toolbar-button toolbar-button-demo-target" type="button" aria-pressed="false" tabindex="-1">Wrap</button>
  <button class="toolbar-button" type="button" aria-pressed="true" tabindex="-1">Whitespace</button>
  <div class="toolbar-separator" role="separator" aria-orientation="vertical"></div>
  <button class="toolbar-button" type="button" tabindex="-1">Format</button>
</div></j3w1-toolbar>

overflow

Markup
<j3w1-toolbar id="example-toolbar-overflow"><div class="toolbar" role="toolbar" aria-label="Editor" aria-orientation="horizontal">
  <button class="toolbar-button" type="button" tabindex="0">Undo</button>
  <button class="toolbar-button" type="button" tabindex="-1">Redo</button>
  <div class="toolbar-separator" role="separator" aria-orientation="vertical"></div>
  <button class="toolbar-button toolbar-button-demo-target" type="button" aria-pressed="false" tabindex="-1">Wrap</button>
  <j3w1-menu><div class="menu"><button class="toolbar-button toolbar-more" type="button" id="example-toolbar-overflow-toolbar-more-trigger" aria-haspopup="menu" aria-expanded="false" aria-controls="example-toolbar-overflow-toolbar-more-menu" tabindex="-1">More</button><ul class="menu-list" role="menu" id="example-toolbar-overflow-toolbar-more-menu" aria-labelledby="example-toolbar-overflow-toolbar-more-trigger" hidden=""><li role="none"><button class="menu-item" type="button" role="menuitem" tabindex="-1" data-action="format">Format</button></li><li role="none"><button class="menu-item" type="button" role="menuitemcheckbox" tabindex="-1" aria-checked="false" data-action="whitespace">Show whitespace</button></li></ul></div></j3w1-menu>
</div></j3w1-toolbar>

Install and register

Use the exact version. If npm publication is pending, install the release tarball from the installation guide.

npm install --save-exact @j3w1/ui@4.0.0
import '@j3w1/ui/tokens.css';
import '@j3w1/ui/styles/toolbar.css';
import '@j3w1/ui/register/toolbar';

Insert the maintained markup above after loading these imports. Its native children provide accessible names and form behavior; the empty custom tag alone does not create a control.

Vue SFC, React, Astro and plain HTML integration →

Copy the complete implementation

npx --package=@j3w1/ui@4.0.0 j3w1-ui copy toolbar --out ./vendor/j3w1/toolbar

The CLI verifies every file before writing and refuses overwrites. Serve the output over HTTP and open index.html. Keep its modules, CSS, tokens and licence notices together.

Public API

attributes

NameType / signatureMeaning
disabledCustomEventDisable the native controls owned by this instance.
loadingCustomEventMark the primary control busy and prevent duplicate activation.

properties

NameType / signatureMeaning
disabledbooleanDelegates disabled state to native children.
namestringNative control name; application form keys remain explicit.

methods

NameType / signatureMeaning
refresh(): voidReconnect behavior after replacing native child structure.
focus(options?: FocusOptions): voidFocus the first usable native control.

events

NameType / signatureMeaning
j3w1-actionCustomEventA toggle action changed.

Dependencies and verification

Registered components: menu. Style dependencies: menu.

Package presence establishes an available implementation. Actual passes depend on the tested artifact and environment. Read specification execution evidence; read packed-consumer evidence; inspect the complete state matrix.

Full implementation manifest, API and token dependency closure

Canonical specification

Toolbar toolbar

  • Family: Navigation
  • Maturity: stable
  • Priority: R1
  • Since: 0.1.0
  • Custom widget: APG toolbar with roving tabindex; buttons, toggle buttons with aria-pressed, and a separator — APG pattern
  • specified
  • demonstrated

A row of related controls under one tab stop with arrow-key movement; ghost buttons, a vertical separator, and a "more" button when the row overflows.

Report an issue with this component

Tokens

Focus a role to inspect its values; follow its link for persistent usage and source details.

PartRoleValueUse
root.bgcolor.surface.chromeapproveduse#000000D-041 surface.chrome: color.primitive.ink.0.
root.bordercolor.border.dividerapproveduse#482b2bD-041 border.divider: color.primitive.modern.divider.
button.textcolor.text.defaultapproveduse#e99499D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
button.bg-hovercolor.interaction.hover.bgapproveduse#1c1010D-041 interaction.hover.bg: color.primitive.modern.hover.
button.bg-pressedcolor.interaction.pressed.bgobserveduse#420f0cPressed fill.
button.ringcolor.interaction.focus.ringobserveduse#e539351px dashed focus ring on controls and rows.
button.text-disabledcolor.text.disabledapproveduse#a3676bD-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
toggled.bgcolor.interaction.pressed.bgobserveduse#420f0cPressed fill.
toggled.bordercolor.border.activeobserveduse#e53935Active or focused control border.
toggled.textcolor.text.brightapproveduse#ffa2a7D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
separator.colorcolor.border.defaultapproveduse#482b2bD-041 border.default: color.primitive.modern.divider.
more.chevroncolor.icon.decorativeapproveduse#986f72D-041 icon.decorative: color.primitive.modern.control.

State matrix

Every declared state and combination, statically rendered; the default cell is live. Sizes: compact, comfortable (switch with the density control above).

StateDefaultOverflow
default
hover
focus-visible
disabled
toggled

Purpose

Groups a view’s frequent actions on the content beneath it into one row that costs one tab stop. Navigation between views belongs in tabs or the sidebar; mutually exclusive choices in a segmented control or radio group.

Anatomy

Parts as listed in the anatomy.

States

StateVisualNon-colour channel
defaulttext color.text.default; no fill; transparent border—
hoverbackground → color.interaction.hover.bgcursor: pointer
focus-visible1px dashed color.interaction.focus.ring ring at −2pxthe ring
disabledtext color.text.disabled; no fill; no hoverdisabled; cursor: not-allowed; skipped by the arrow keys
toggledfill color.interaction.pressed.bg; 1px color.border.active border; text color.text.brightaria-pressed="true"; the border

A press shows color.interaction.pressed.bg only while it lasts; a toggled button keeps it.

Keyboard

As in the key table. The roving stop is the last focused control, initially the first enabled one.

Accessibility

A page with several toolbars names each distinctly. A toggle button’s label does not change with its state. Icon-only buttons carry aria-label and a tooltip. Text meets 4.5:1, the toggled border and the ring 3:1. Every control is at least 24×24 CSS pixels with 4px between neighbours in compact.

Portability

Toolkits with a native toolbar keep their own keyboard model and take the colours. The overflow menu is the menu component; hosts without one wrap the row and record the deviation.

Non-examples

Buttons bordered at rest. A filled primary button in the toolbar. Rounded buttons or a pill-shaped toolbar. Every button in the tab order when script is available. A toggled state by colour alone without aria-pressed. A toolbar wrapping to two lines. A focusable separator. Disabling by opacity.

Contrast report

9 declared pairs measured on resolved sRGB values with the WCAG 2.x formula; 0 waived (decorative only), 0 failing. A pass is a design target for the named role, not an application-wide conformance claim.

PairStateKindForegroundBackgroundRatioMinResult
toolbar default textdefaulttextcolor.text.default #e99499color.surface.chrome #0000009.164.5pass
toolbar hover texthovertextcolor.text.default #e99499color.interaction.hover.bg #1c10108.104.5pass
toolbar focus-visible textfocus-visibletextcolor.text.default #e99499color.surface.chrome #0000009.164.5pass
toolbar focus-visible outlinefocus-visibleuicolor.interaction.focus.ring #e53935color.surface.chrome #0000004.973pass
toolbar toggled texttoggledtextcolor.text.bright #ffa2a7color.interaction.pressed.bg #420f0c8.414.5pass
toolbar toggled bordertoggleduicolor.border.active #e53935color.interaction.pressed.bg #420f0c3.813pass
disabled button text (exempt; house floor 3:1)disableduicolor.text.disabled #a3676bcolor.surface.chrome #0000004.713pass
separator (decorative; role separator carries the grouping)—uicolor.border.default #482b2bcolor.surface.chrome #0000001.661pass
toolbar bottom edge (decorative)—uicolor.border.divider #482b2bcolor.surface.chrome #0000001.661pass

Keys

KeyAction
Tab / Shift+TabEnters or leaves the toolbar; one control has tabindex 0 (roving tabindex).
Left / RightMoves focus to the previous or next enabled control; wraps at the ends; Up and Down when aria-orientation is vertical.
Home / EndMoves focus to the first or last control.
Enter / SpaceActivates the focused button or toggles a toggle button.
EscapeRestores the previous value in a toolbar that edits, otherwise nothing.

For agents

Component JSON ·Implementation brief ·Build a task kit ·

Related: button icon-button menu tabs button-group

Stress fixtures: FX-320 FX-ZOOM-200 FX-I18N FX-RTL FX-RM FX-HC FX-OVERFLOW FX-STATE-MATRIX