OGE logoOGE

Toolbar

<oge-toolbar> groups commands into a role="toolbar" bar with a roving tabindex, three location groups, and an overflow menu for the commands that stop fitting. Entries come from declarative <oge-toolbar-item> children, from a data-driven items array, or both.

Most reference toolbars are purely presentational — no keyboard model and no overflow handling at all. The fitting math lives in @oge-ui/core as a pure function, so it is unit-tested with numbers rather than pixels.

APG toolbar overflow menu signals RTL zoneless

Commands

Each <oge-toolbar-item> renders a button by default. severity picks the emphasis, type="separator" draws a rule, and every item has its own itemClick.

oge-toolbar-item severity separator

last command → —

Data-driven items

The same entries as an array. Children render first when both sources are used — the merge rule shared with the tabs and accordion families. active renders a toggle button with aria-pressed.

[items] itemClick label active
Draft

last command → —

Location groups

before and after take their natural width; center claims the rest and centres inside it. Everything uses logical properties, so the order mirrors in RTL with no flag to set.

location before center after
report.xlsx

Overflow menu

Drag the width down and the trailing commands collapse into the menu. locateInMenu defaults to 'auto'; 'always' pins an item to the menu whatever the width, 'never' keeps it on the bar even if the row overflows.

overflow locateInMenu overflowChanged
520px

in the menu → 0 command(s)

Overflow priority

Every reference toolbar drops strictly from the end of the row, so keeping a primary command means moving it to the front. overflowPriority separates yield order from visual order — higher survives longer — and equal priorities fall back to end-first, so the default reproduces the reference behaviour exactly.

overflowPriority
520px

Narrow it: “Save” sits last on the bar and is still the last to leave.

Overflow modes

Five modes, one input — the union of every mode the reference libraries offer. scroll keeps a single line and adds arrows, extended hides the remainder in a second row behind a toggle that names it through aria-controls.

menu scroll wrap extended none

Toggle commands

A defined active is what makes an item a toggle. Declarative children own a two-way model and flip themselves; items entries are data the toolbar must not mutate, so it reports through activeChanged and the app applies it.

[(active)] aria-pressed activeChanged

bold true · italic false · last —

Runtime changes

items stays the declared source of truth and the imperative calls are an override layer on top of it — so a re-supplied array cannot silently undo a hideItem(). dataSource loads the same shape from a server.

addItem hideItem enableItem refreshOverflow

Icon-only commands

showText="inMenu" renders the bar entry icon-only and keeps the label for the overflow menu. The button never loses its accessible name — the text becomes its aria-label.

showText icon aria-label

Custom content

Two escape hatches instead of a string-keyed widget + options bag. A projection slot puts any control straight on the bar — where it stays, because the toolbar cannot re-stamp DOM it does not own. An ogeToolbarItemTemplate inside an item is re-stampable, so that entry can still collapse into the menu.

ogeToolbarAfter ogeToolbarItemTemplate

Keyboard & accessibility

One Tab stop for the whole toolbar, arrow keys between the controls, Home/End to the ends, disabled controls skipped. A vertical toolbar uses Up/Down and reports aria-orientation. A text input inside keeps its own arrow and Home/End keys — the APG warns against stealing them.

roving tabindex orientation wrap

Configuration

Every user-facing string — including the overflow button's accessible name — lives in the messages interface, overridable application-wide or per instance with [messages].

provideOgeToolbarConfig