| title | description | status | thumb | image | storybook | figma_url | keywords | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Button |
A button is an UI element which signals key actions to take an action throughout an app. It is important a button is identifiable, consistent, communicates its actions clearly, and is appropriately sized to its action. |
ready |
true |
assets/images/components/button.png |
|
<button>and link (<a>) HTML elements each describe a specific intent. Understanding the distinction is important: if it goes somewhere, it's a link (<a>). If an action occurs, use a Button (<button>). When you need button styling with navigation behavior (CTAs, toolbar actions that navigate), use DtButton'shrefortoprops — see Navigation.- Avoid using too many buttons on a page.
- Set the
typeattribute to define its purpose:submit,button, orreset. Browsers default tosubmitif it isn't defined, and that cannot be assumed as the preferred behavior.
- Conveying that an action that will occur when invoked.
- To trigger an action or behavior, such as submitting a form or spawning a Modal.
- Avoid using to navigate between destinations, deferring to a Link instead. Exception: use DtButton with
hrefortowhen button styling is intentional (e.g. CTAs, toolbar actions).
Button labels should be clear and predictable so users have confidence in their actions.
- Lead with a strong verb and use verb + noun structure except for common actions like “Done,” “Close,” “Cancel,” or “OK”
- Should be sentence case
- Do not use punctuation
- Avoid unnecessary articles such as “the,” “an,” and “a.”
- Add number
- Create menu
- Add Number
- Create a menu
Dialtone provides five options for kind, with three levels of importance.
The base button should be the go-to button for most of your needs. When in doubt, use this style. To help provide clarity to users, it is generally recommended to use only one primary button style within a section or page.
Place Call Place Call Place CallThe danger button style is used to communicate critical or destructive actions such as deleting content, accounts, or canceling services.
Place Call Place Call Place CallThe positive button style is used to communicate positive actions.
Place Call Place Call Place CallThe muted button style is used to communicate non-primary actions for contexts in which the base style may not work (e.g. colored backgrounds, validation components, etc). This style’s use should be rare. When in doubt, use the default button style.
Place Call Place Call Disabled Place Call Place Call Place Call Place Call Place Call Place Call Place Call Place Call Place Call Place Call Place CallButtons can be disabled using the disabled attribute or the Dialtone class, d-btn--disabled. Use the attribute when a button should appear disabled and not receive focus; use the class when a button should appear disabled but still receive focus (i.e. a disabled button with a tooltip).
Using the class also requires aria-disabled, and additional javascript implementation is required to prevent events.
<code-example-tabs :htmlCode='() => $refs.disabledExample' vueCode='
Place Call
Place Call (disabled class) ' showHtmlWarning />Buttons can be set to active state using the active prop or .d-btn--active Dialtone class.
Buttons can be styled as a Link in situations for which you need the appearance of a link but behavior of a button. Using the button element provides a better accessibility experience.
This inverts the underline behavior. With underline="false", the link will not have an underline by default, but will show one on hover.
The unstyled button removes all default Dialtone styling while preserving the semantic HTML <button> element and maintaining proper button behavior and accessibility.
<dt-notice title="Deprecated" kind="info" class="d-wmx100p d-my16"
kind="inverted" has been deprecated. Use the v-dt-mode directive instead, or DtModeIsland.
Use the v-dt-mode directive in place of kind="inverted" on the component element. The previous inverted variant of DtButton was limited to a single presentation style. The directive now makes every combination available as an inverted style.
DtButton can render as an <a> or <router-link> for cases where you need button styling with navigation behavior.
- Navigating within the app? Use
to. Renders<router-link>for client-side navigation without page reloads. - Linking to an external site? Use
href. Renders<a>for standard browser navigation. - Triggering an action? Use neither. Renders
<button>(default).
Pass href to render as an <a> element. Use target="_blank" and rel="noopener noreferrer" for external links.
<code-example-tabs :htmlCode='() => $refs.hrefExample1' vueCode=' <dt-button href="https://dialtone.dialpad.com" target="_blank" rel="noopener noreferrer" kind="muted" importance="outlined" size="sm" icon-position="right"
<template #icon="{ iconSize }"> Dialtone ' showHtmlWarning />
Pass to to render as <router-link> for internal client-side SPA navigation. Use replace to navigate without adding a history entry.
If you have existing <a class="d-btn"> or <router-link class="d-btn"> workarounds, replace them with DtButton props:
<code-example-tabs vueCode='
<a class="d-btn d-btn--primary d-btn--outlined d-btn--sm" href="https://example.com" target="_blank" rel="noopener noreferrer"
Link Text
<dt-button href="https://example.com" target="_blank" rel="noopener noreferrer" importance="outlined" size="sm"
Link Text ' />
<code-example-tabs vueCode='
<router-link class="d-btn d-btn--primary d-btn--sm" :to="roomPath"
Join Room
Join Room ' />The default button size is md, but does not need to be explicitly specified.
<dt-notice kind="info" class="d-wmx100p d-my24" hide-close title="Note"
startIcon and endIcon slots replace the previous icon slot and icon-position prop, which are deprecated and will be sunset.
Place icons before and/or after inline of the label with startIcon and endIcon slots.
Place icons above or below the label with blockStartIcon and blockEndIcon slots.
Icon-only buttons are commonly used for toggling actions, navigation, or closing UI elements.
The following styles are available as a circle shape.
Loading buttons are useful for communicating a delay between the button interaction and its action taking place. Every button style can accept the loading button class, though we only provide a few possible examples.
The width of the button remains determined by the length of the label, which is visually hidden in this state.
Place Call Place Call Validating Validating Validating ValidatingUse the #leading and #trailing slots to render freeform content at the start or end of a button — outside the label area but inside the button's border. Common use cases include badges, count indicators, or keyboard shortcut hints. Use leading-class and trailing-class to add padding or styling to the slot containers.
<dt-notice kind="info" title="Info"
This is not to be confused with #icon slots, which are specifically for icons. leading and trailing are essentially freeform.
<dt-notice kind="info" class="d-wmx100p d-my16"
DtSplitButton is its own component containing multiple DtButtons.
Place call Option 1 Option 2 Option 3We provide the following branded buttons for log-in and sign-up workflows.
Log in with Google Log in with Office365 Log in with LinkedIn<button class="d-btn d-btn--brand d-btn--google" type="button">
<span class="d-btn__icon"><icon-google-glyph /></span>
<span class="d-btn__label">Log in with Google</span>
</button>
<button class="d-btn d-btn--brand d-btn--o365" type="button">
<span class="d-btn__icon"><icon-google-glyph /></span>
<span class="d-btn__label">Log in with Office365</span>
</button>
<button class="d-btn d-btn--brand d-btn--linkedin" type="button">
<span class="d-btn__icon"><icon-google-glyph /></span>
<span class="d-btn__label">Log in with LinkedIn</span>
</button>- Choosing between Link and Button elements is paramount for screenreaders to inform the user what will occur. For example: will it go somewhere (Link) or will something happen (Button)?
- Do not rely on color alone to convey the intent of the button. Defer to the button text as primary way to convey the buttons intent.
- Display a visible focus state when users tab to them.
- Use standard semantic usage of HTML elements.
- Be aware of how screenreaders handle buttons and links differently. For example, both the
EnterandSpacekeys triggers a button, while links are triggered only by theEnterkey. - If it is a button type while focused:
- Pressing the
EnterorSpacekey should trigger the action. - Pressing the
Tabkey moves focus to the next focusable element. - Pressing the
Shift+Tabkey moves focus to the previous focusable element.
- Pressing the
- When using DtButton with
hreforto, the component automatically handles Spacebar activation and disabled state (aria-disabled,tabindex="-1"). Navigating elements keep their native link role —role="button"is not added because the element navigates rather than performing an in-page action.