Dojo NG is being built in the open, one section at a time — follow along on Heptapod.

API REFERENCE · NAVIGATION

<dj-toolbar>

A horizontal action bar with role="toolbar".

Try it in the playground

@dojo-ng/toolbar · v0.1.1

npm install @dojo-ng/toolbar

import "@dojo-ng/toolbar";

Layout

  • The leading slot holds a logo or a menu or back button.
  • The default slot holds the title or other content.
  • The actions slot holds the primary action buttons, aligned to the end.
  • sticky pins the bar to the top.

Overflow menu

  • Set the overflow property to a list of options to put secondary actions in a menu. A ⋮ button opens them in a popup <dj-list>.
  • Choosing one emits dj-action with its value.
  • The menu closes when an item is chosen, on Escape, on a click outside, and when focus leaves it.

Not built

  • Moving slotted actions into the menu automatically when space runs out. For now your app decides which actions are primary and which go in overflow.

Need one of these? Make a request on Discord or add an issue (work item) on Heptapod.

Properties

PropertyAttributeTypeDefault
labelAccessible name for the toolbar (sets aria-label on the bar). label string None
sticky sticky reflected boolean false
overflowSecondary actions rendered behind the overflow (⋮) button. Property only ListOption[] []
overflowPosition overflow-position reflected "above""below""left""right" "below"

Events

EventDescription
dj-actiondetail: { value }

Slots

SlotDescription
leadinga logo, or a menu or back button.
Default slotthe title or other content.
actionsthe primary action buttons, aligned to the end.

CSS parts

Style these with dj-toolbar::part(name).

barleadingtitleactionsoverflow

Types

The types that the properties above use, as they are declared in the source.

ListOption from @dojo-ng/list

export interface ListOption { value: string; label: string; disabled?: boolean; divider?: boolean; }