Skip to main content
Version: 1.x

fast-toolbar

As defined by the W3C:

A toolbar is a container for grouping a set of controls, such as buttons, menubuttons, or checkboxes.

When a set of controls is visually presented as a group, the toolbar role can be used to communicate the presence and purpose of the grouping to screen reader users. Grouping controls into toolbars can also be an effective way of reducing the number of tab stops in the keyboard interface.

Setup

import {
provideFASTDesignSystem,
fastToolbar
} from "@microsoft/fast-components";

provideFASTDesignSystem()
.register(
fastToolbar()
);

Usage

Live Editor
<fast-toolbar>
    <fast-button>Button</fast-button>
    <fast-radio-group>
        <fast-radio checked>One</fast-radio>
        <fast-radio>Two</fast-radio>
        <fast-radio>Three</fast-radio>
    </fast-radio-group>
    <fast-combobox>
        <fast-option>Please Please Me</fast-option>
        <fast-option>With The Beatles</fast-option>
        <fast-option>A Hard Day's Night</fast-option>
        <fast-option>Beatles for Sale</fast-option>
        <fast-option>Help!</fast-option>
        <fast-option>Rubber Soul</fast-option>
        <fast-option>Revolver</fast-option>
        <fast-option>Sgt. Pepper's Lonely Hearts Club Band</fast-option>
        <fast-option>Magical Mystery Tour</fast-option>
        <fast-option>The Beatles</fast-option>
        <fast-option>Yellow Submarine</fast-option>
        <fast-option>Abbey Road</fast-option>
        <fast-option>Let It Be</fast-option>
    </fast-combobox>
    <fast-button>Button</fast-button>
    <fast-select>
        <fast-option>Option 1</fast-option>
        <fast-option>Second option</fast-option>
        <fast-option>Option 3</fast-option>
    </fast-select>
</fast-toolbar>
Result
Loading...

Create your own design

import {
Toolbar,
toolbarTemplate as template,
} from "@microsoft/fast-foundation";
import { toolbarStyles as styles } from "./my-toolbar.styles";

export const myToolbar = Toolbar.compose({
baseName: "toolbar",
template,
styles,
shadowOptions: {
delegatesFocus: true,
},
});

API

class: Toolbar

Superclass

NameModulePackage
FoundationElement/src/foundation-element/foundation-element.js

Fields

NamePrivacyTypeDefaultDescriptionInherited From
activeIndex
orientationpublicOrientationThe orientation of the toolbar.
childItemspublicElement[]
$presentationpublicComponentPresentation or nullA property which resolves the ComponentPresentation instance for the current component.FoundationElement
templatepublicElementViewTemplate or void or nullSets the template of the element instance. When undefined, the element will attempt to resolve the template from the associated presentation or custom element definition.FoundationElement
stylespublicElementStyles or void or nullSets the default styles for the element instance. When undefined, the element will attempt to resolve default styles from the associated presentation or custom element definition.FoundationElement

Methods

NamePrivacyDescriptionParametersReturnInherited From
slottedItemsChangedprotectedvoid
childItemsChangedprotectedprev: undefined or Element[], next: Element[]void
templateChangedprotectedvoidFoundationElement
stylesChangedprotectedvoidFoundationElement

Attributes

NameFieldInherited From
orientationorientation

CSS Parts

NameDescription
positioning-regionThe element containing the items, start and end slots

Slots

NameDescription
startContent which can be provided before the slotted items
endContent which can be provided after the slotted items
The default slot for slotted items
labelThe toolbar label

class: DelegatesARIAToolbar

Fields

NamePrivacyTypeDefaultDescriptionInherited From
ariaLabelledbypublicstring or nullThe id of the element labeling the toolbar.
ariaLabelpublicstring or nullThe label surfaced to assistive technologies.

Attributes

NameFieldInherited From
aria-labelledbyariaLabelledby
aria-labelariaLabel

Additional resources