Toolbar

July 31, 2019 ยท View on GitHub

Displays a horizontal bar containing a label and action items.

See Material Design Toolbars for examples of different usages.

Main features

  • Flexibly composable with labels and icon buttons
  • Optional compact display
  • RTL (right-to-left) support

Usage

Options

Toolbar options

ParameterRequiredTypeDefaultDescription
borderoptionalBooleanfalseSet to true to add a bottom border
compactoptionalBooleanfalseSet to true to create a more compact Toolbar
fullbleedoptionalBooleanfalseSet to true to remove side padding
shadowDepthoptionalNumber 0-5No shadowDepth of the shadow

ToolbarTitle options

ParameterRequiredTypeDefaultDescription
centeroptionalBooleanfalseSet to true to center the text
indentoptionalBooleanfalseSet to true to indent the text as if it would be next to an icon
texteither text or childrenBooleanTitle text
urloptionalObject with href, optionally oncreate (for Mithril 1.x) or onClick (for React) or to (for React Router)URL location; Mithril 2.x: for in-app route linking set only use url.href and set element to m.route.Link; Mithril 1.x: for in-app route linking set oncreate : m.route.link; React: for in-app route linking use onClick and a router such as react-router-dom

Common component options

ParameterRequiredTypeDefaultDescription
afteroptionalString, hyperscript or componentExtra content after main content; note that this content is placed right of preceding elements with a higher stacking depth
beforeoptionalString, hyperscript or componentExtra content before main content; note that this content is placed left of subsequent elements with a lower stacking depth
classNameoptionalStringExtra CSS class appended to pe-toolbar
contenteither a bar or content must be passedString, hyperscript or componentAlternative content; replaces children
elementoptionalString"div"HTML element tag
eventsoptionalObjectOptions object containing one or more standard events such as onclick (React: onClick)
idoptionalStringHTML element id
styleoptionalObjectFor setting simple style attributes
toneoptionalString: "dark" or "light"Renders the component light on dark (sets class pe-dark-tone); use "light" to locally inverse (sets class pe-light-tone)

Composition

Toolbar is often composed from:

CSS classes