Primary buttons are the most prominent type of button available. They are used for a single, necessary action a developer must complete, or for a highly recommended, promoted action. Use them sparingly and with purpose.
Use tonal buttons in dialogs for actions that stand secondary to a primary action and are not a cancel or close action.
Outlined buttons are the default button style. Use them for regular actions in the UI or to cancel dialogs.
Text buttons are the least prominent button choice. Use them in cases outlined buttons would create too much visual noise.
Micro buttons are used if we have a small line height.
Use icon buttons in toolbars of contextual actions that shouldn’t take up much space.
devtools-button
for Primary, Outlined, Text, Micro and Icon buttonsToolbarButton
for buttons inside Toolbars
. Underneath they make use of devtools-button
.<button>
, as they are not styled correctlyUsage within HTML environment:
<devtools-button class="some-class" .variant=${Buttons.Button.Variant.PRIMARY} .title=${i18nString(UIStrings.someString)} .jslogContext=${'some-context') @click=${handleClick()} )></devtools-button>
Usage within Typescript environment (mostly when working with legacy code):
const button = new Buttons.Button.Button(); button.data = { variant: Buttons.Button.Variant.PRIMARY, title: i18nString(UIStrings.someString), jslogContext: 'some-context', }; button.classList.add(‘some-class’); button.addEventListener(‘click’, () => handleClick());