sp-action-button

Examples API

Attributes and Properties #

Property Attribute Type Default Description
active active boolean false
autofocus autofocus boolean false When this control is rendered, focus it automatically
disabled disabled boolean false Disable this control. It will not receive focus or events
download download string | undefined
emphasized emphasized boolean false
holdAffordance hold-affordance boolean false
href href string | undefined
label label string | undefined
quiet quiet boolean false
rel rel string | undefined
role role string 'button'
selected selected boolean false Whether an Action Button with `role='button'` should also be `aria-pressed='true'`
size size ElementSize
tabIndex tabIndex number The tab index to apply to this control. See general documentation about the tabindex HTML property
target target '_blank' | '_parent' | '_self' | '_top' | undefined
toggles toggles boolean false Whether to automatically manage the `selected` attribute on interaction and whether `aria-pressed="false"` should be used when `selected === false`
type type 'button' | 'submit' | 'reset' 'button'
value value string

Slots #

Name Description
default slot text label of the Action Button
icon The icon to use for Action Button

Events #

Name Type Description
change Event Announces a change in the `selected` property of an action button
longpress CustomEvent Synthesizes a "longpress" interaction that signifies a `pointerdown` event that is >=300ms or a keyboard event wher code is `Space` or code is `ArrowDown` while `altKey===true`.

CSS Custom Properties #

Name Default
--spectrum-actionbutton-l-icononly-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-l-icononly-padding-left var(--spectrum-global-dimension-size-125)
--spectrum-actionbutton-l-icononly-padding-right var(--spectrum-global-dimension-size-125)
--spectrum-actionbutton-l-quiet-textonly-border-radius var(--spectrum-alias-component-border-radius)
--spectrum-actionbutton-l-quiet-textonly-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-l-quiet-textonly-text-font-weight var(--spectrum-alias-body-text-font-weight)
--spectrum-actionbutton-l-quiet-textonly-text-size var(--spectrum-global-dimension-font-size-200)
--spectrum-actionbutton-l-texticon-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-l-texticon-icon-gap var(--spectrum-global-dimension-size-115)
--spectrum-actionbutton-l-texticon-padding-left var(--spectrum-global-dimension-size-160)
--spectrum-actionbutton-l-textonly-border-radius var(--spectrum-alias-component-border-radius)
--spectrum-actionbutton-l-textonly-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-l-textonly-height var(--spectrum-global-dimension-size-500)
--spectrum-actionbutton-l-textonly-hold-icon-padding-bottom var(--spectrum-global-dimension-size-65)
--spectrum-actionbutton-l-textonly-hold-icon-padding-right var(--spectrum-global-dimension-size-65)
--spectrum-actionbutton-l-textonly-min-width var(--spectrum-global-dimension-size-400)
--spectrum-actionbutton-l-textonly-padding-left var(--spectrum-global-dimension-size-185)
--spectrum-actionbutton-l-textonly-padding-right var(--spectrum-global-dimension-size-185)
--spectrum-actionbutton-l-textonly-text-font-weight var(--spectrum-alias-body-text-font-weight)
--spectrum-actionbutton-l-textonly-text-line-height var(--spectrum-alias-component-text-line-height)
--spectrum-actionbutton-l-textonly-text-size var(--spectrum-global-dimension-font-size-200)
--spectrum-actionbutton-m-emphasized-texticon-icon-color var(--spectrum-alias-component-icon-color-default)
--spectrum-actionbutton-m-emphasized-texticon-icon-color-disabled var(--spectrum-alias-component-icon-color-disabled)
--spectrum-actionbutton-m-emphasized-texticon-icon-color-hover var(--spectrum-alias-component-icon-color-hover)
--spectrum-actionbutton-m-emphasized-texticon-icon-color-key-focus var(--spectrum-alias-component-icon-color-key-focus)
--spectrum-actionbutton-m-emphasized-texticon-icon-color-selected var(--spectrum-alias-component-icon-color-emphasized-selected-default)
--spectrum-actionbutton-m-emphasized-texticon-icon-color-selected-disabled var(--spectrum-alias-component-icon-color-disabled)
--spectrum-actionbutton-m-emphasized-texticon-icon-color-selected-down var(--spectrum-alias-component-icon-color-emphasized-selected-down)
--spectrum-actionbutton-m-emphasized-texticon-icon-color-selected-hover var(--spectrum-alias-component-icon-color-emphasized-selected-hover)
--spectrum-actionbutton-m-emphasized-texticon-icon-color-selected-key-focus var(--spectrum-alias-component-icon-color-emphasized-selected-key-focus)
--spectrum-actionbutton-m-emphasized-textonly-background-color var(--spectrum-alias-component-background-color-default)
--spectrum-actionbutton-m-emphasized-textonly-background-color-disabled var(--spectrum-alias-component-background-color-disabled)
--spectrum-actionbutton-m-emphasized-textonly-background-color-down var(--spectrum-alias-component-background-color-down)
--spectrum-actionbutton-m-emphasized-textonly-background-color-hover var(--spectrum-alias-component-background-color-hover)
--spectrum-actionbutton-m-emphasized-textonly-background-color-key-focus var(--spectrum-alias-component-background-color-key-focus)
--spectrum-actionbutton-m-emphasized-textonly-background-color-selected var(--spectrum-alias-component-background-color-emphasized-selected-default)
--spectrum-actionbutton-m-emphasized-textonly-background-color-selected-disabled var(--spectrum-alias-component-background-color-disabled)
--spectrum-actionbutton-m-emphasized-textonly-background-color-selected-down var(--spectrum-alias-component-background-color-emphasized-selected-down)
--spectrum-actionbutton-m-emphasized-textonly-background-color-selected-hover var(--spectrum-alias-component-background-color-emphasized-selected-hover)
--spectrum-actionbutton-m-emphasized-textonly-background-color-selected-key-focus var(--spectrum-alias-component-background-color-emphasized-selected-key-focus)
--spectrum-actionbutton-m-emphasized-textonly-border-color var(--spectrum-alias-component-border-color-default)
--spectrum-actionbutton-m-emphasized-textonly-border-color-disabled var(--spectrum-alias-component-border-color-disabled)
--spectrum-actionbutton-m-emphasized-textonly-border-color-down var(--spectrum-alias-component-border-color-down)
--spectrum-actionbutton-m-emphasized-textonly-border-color-hover var(--spectrum-alias-component-border-color-hover)
--spectrum-actionbutton-m-emphasized-textonly-border-color-key-focus var(--spectrum-alias-component-border-color-key-focus)
--spectrum-actionbutton-m-emphasized-textonly-border-color-selected var(--spectrum-alias-component-border-color-emphasized-selected-default)
--spectrum-actionbutton-m-emphasized-textonly-border-color-selected-disabled var(--spectrum-alias-component-border-color-disabled)
--spectrum-actionbutton-m-emphasized-textonly-border-color-selected-down var(--spectrum-alias-component-border-color-emphasized-selected-down)
--spectrum-actionbutton-m-emphasized-textonly-border-color-selected-hover var(--spectrum-alias-component-border-color-emphasized-selected-hover)
--spectrum-actionbutton-m-emphasized-textonly-border-color-selected-key-focus var(--spectrum-alias-component-border-color-emphasized-selected-key-focus)
--spectrum-actionbutton-m-emphasized-textonly-hold-icon-color var(--spectrum-alias-component-icon-color-default)
--spectrum-actionbutton-m-emphasized-textonly-hold-icon-color-disabled var(--spectrum-alias-component-icon-color-disabled)
--spectrum-actionbutton-m-emphasized-textonly-hold-icon-color-down var(--spectrum-alias-component-icon-color-down)
--spectrum-actionbutton-m-emphasized-textonly-hold-icon-color-hover var(--spectrum-alias-component-icon-color-hover)
--spectrum-actionbutton-m-emphasized-textonly-hold-icon-color-key-focus var(--spectrum-alias-component-icon-color-key-focus)
--spectrum-actionbutton-m-emphasized-textonly-hold-icon-color-selected var(--spectrum-alias-component-icon-color-emphasized-selected-default)
--spectrum-actionbutton-m-emphasized-textonly-text-color var(--spectrum-alias-component-text-color-default)
--spectrum-actionbutton-m-emphasized-textonly-text-color-disabled var(--spectrum-alias-component-text-color-disabled)
--spectrum-actionbutton-m-emphasized-textonly-text-color-down var(--spectrum-alias-component-text-color-down)
--spectrum-actionbutton-m-emphasized-textonly-text-color-hover var(--spectrum-alias-component-text-color-hover)
--spectrum-actionbutton-m-emphasized-textonly-text-color-key-focus var(--spectrum-alias-component-text-color-key-focus)
--spectrum-actionbutton-m-emphasized-textonly-text-color-selected var(--spectrum-alias-component-text-color-emphasized-selected-default)
--spectrum-actionbutton-m-emphasized-textonly-text-color-selected-disabled var(--spectrum-alias-component-text-color-disabled)
--spectrum-actionbutton-m-emphasized-textonly-text-color-selected-down var(--spectrum-alias-component-text-color-emphasized-selected-down)
--spectrum-actionbutton-m-emphasized-textonly-text-color-selected-hover var(--spectrum-alias-component-text-color-emphasized-selected-hover)
--spectrum-actionbutton-m-emphasized-textonly-text-color-selected-key-focus var(--spectrum-alias-component-text-color-emphasized-selected-key-focus)
--spectrum-actionbutton-m-icononly-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-m-icononly-padding-left var(--spectrum-global-dimension-size-85)
--spectrum-actionbutton-m-icononly-padding-right var(--spectrum-global-dimension-size-85)
--spectrum-actionbutton-m-quiet-textonly-background-color var(--spectrum-alias-component-background-color-quiet-default)
--spectrum-actionbutton-m-quiet-textonly-background-color-disabled var(--spectrum-alias-component-background-color-quiet-disabled)
--spectrum-actionbutton-m-quiet-textonly-background-color-down var(--spectrum-alias-component-background-color-quiet-down)
--spectrum-actionbutton-m-quiet-textonly-background-color-hover var(--spectrum-alias-component-background-color-quiet-hover)
--spectrum-actionbutton-m-quiet-textonly-background-color-key-focus var(--spectrum-alias-component-background-color-quiet-key-focus)
--spectrum-actionbutton-m-quiet-textonly-background-color-selected var(--spectrum-alias-component-background-color-selected-default)
--spectrum-actionbutton-m-quiet-textonly-background-color-selected-disabled var(--spectrum-alias-component-background-color-quiet-selected-disabled)
--spectrum-actionbutton-m-quiet-textonly-background-color-selected-down var(--spectrum-alias-component-background-color-quiet-selected-down)
--spectrum-actionbutton-m-quiet-textonly-background-color-selected-hover var(--spectrum-alias-component-background-color-quiet-selected-hover)
--spectrum-actionbutton-m-quiet-textonly-background-color-selected-key-focus var(--spectrum-alias-component-background-color-quiet-selected-key-focus)
--spectrum-actionbutton-m-quiet-textonly-border-color var(--spectrum-alias-component-border-color-quiet-default)
--spectrum-actionbutton-m-quiet-textonly-border-color-disabled var(--spectrum-alias-component-border-color-quiet-disabled)
--spectrum-actionbutton-m-quiet-textonly-border-color-down var(--spectrum-alias-component-border-color-quiet-down)
--spectrum-actionbutton-m-quiet-textonly-border-color-hover var(--spectrum-alias-component-border-color-quiet-hover)
--spectrum-actionbutton-m-quiet-textonly-border-color-key-focus var(--spectrum-alias-component-border-color-quiet-key-focus)
--spectrum-actionbutton-m-quiet-textonly-border-color-selected var(--spectrum-alias-component-border-color-quiet-selected-default)
--spectrum-actionbutton-m-quiet-textonly-border-color-selected-disabled var(--spectrum-alias-component-border-color-quiet-disabled)
--spectrum-actionbutton-m-quiet-textonly-border-color-selected-down var(--spectrum-alias-component-border-color-quiet-selected-down)
--spectrum-actionbutton-m-quiet-textonly-border-color-selected-hover var(--spectrum-alias-component-border-color-quiet-selected-hover)
--spectrum-actionbutton-m-quiet-textonly-border-color-selected-key-focus var(--spectrum-alias-component-border-color-quiet-selected-key-focus)
--spectrum-actionbutton-m-quiet-textonly-border-radius var(--spectrum-alias-component-border-radius)
--spectrum-actionbutton-m-quiet-textonly-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-m-quiet-textonly-border-size-key-focus var(--spectrum-alias-border-size-thick)
--spectrum-actionbutton-m-quiet-textonly-text-color var(--spectrum-alias-component-text-color-default)
--spectrum-actionbutton-m-quiet-textonly-text-color-disabled var(--spectrum-alias-component-text-color-disabled)
--spectrum-actionbutton-m-quiet-textonly-text-color-down var(--spectrum-alias-component-text-color-down)
--spectrum-actionbutton-m-quiet-textonly-text-color-hover var(--spectrum-alias-component-text-color-hover)
--spectrum-actionbutton-m-quiet-textonly-text-color-key-focus var(--spectrum-alias-component-text-color-key-focus)
--spectrum-actionbutton-m-quiet-textonly-text-color-selected var(--spectrum-alias-component-text-color-selected-default)
--spectrum-actionbutton-m-quiet-textonly-text-color-selected-disabled var(--spectrum-alias-component-text-color-disabled)
--spectrum-actionbutton-m-quiet-textonly-text-color-selected-down var(--spectrum-alias-component-text-color-selected-down)
--spectrum-actionbutton-m-quiet-textonly-text-color-selected-hover var(--spectrum-alias-component-text-color-selected-hover)
--spectrum-actionbutton-m-quiet-textonly-text-color-selected-key-focus var(--spectrum-alias-component-text-color-selected-key-focus)
--spectrum-actionbutton-m-quiet-textonly-text-font-weight var(--spectrum-alias-body-text-font-weight)
--spectrum-actionbutton-m-quiet-textonly-text-size var(--spectrum-global-dimension-font-size-100)
--spectrum-actionbutton-m-texticon-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-m-texticon-icon-color var(--spectrum-alias-component-icon-color-default)
--spectrum-actionbutton-m-texticon-icon-color-disabled var(--spectrum-alias-component-icon-color-disabled)
--spectrum-actionbutton-m-texticon-icon-color-hover var(--spectrum-alias-component-icon-color-hover)
--spectrum-actionbutton-m-texticon-icon-color-key-focus var(--spectrum-alias-component-icon-color-key-focus)
--spectrum-actionbutton-m-texticon-icon-color-selected var(--spectrum-alias-component-icon-color-selected)
--spectrum-actionbutton-m-texticon-icon-color-selected-disabled var(--spectrum-alias-component-icon-color-disabled)
--spectrum-actionbutton-m-texticon-icon-color-selected-down var(--spectrum-alias-component-icon-color-selected)
--spectrum-actionbutton-m-texticon-icon-color-selected-hover var(--spectrum-alias-component-icon-color-selected)
--spectrum-actionbutton-m-texticon-icon-color-selected-key-focus var(--spectrum-alias-component-icon-color-selected)
--spectrum-actionbutton-m-texticon-icon-gap var(--spectrum-global-dimension-size-100)
--spectrum-actionbutton-m-texticon-padding-left undefined
--spectrum-actionbutton-m-textonly-background-color var(--spectrum-alias-component-background-color-default)
--spectrum-actionbutton-m-textonly-background-color-disabled var(--spectrum-alias-component-background-color-disabled)
--spectrum-actionbutton-m-textonly-background-color-down var(--spectrum-alias-component-background-color-down)
--spectrum-actionbutton-m-textonly-background-color-hover var(--spectrum-alias-component-background-color-hover)
--spectrum-actionbutton-m-textonly-background-color-key-focus var(--spectrum-alias-component-background-color-key-focus)
--spectrum-actionbutton-m-textonly-background-color-selected var(--spectrum-alias-component-background-color-selected-default)
--spectrum-actionbutton-m-textonly-background-color-selected-disabled var(--spectrum-alias-component-background-color-disabled)
--spectrum-actionbutton-m-textonly-background-color-selected-down var(--spectrum-alias-component-background-color-selected-down)
--spectrum-actionbutton-m-textonly-background-color-selected-hover var(--spectrum-alias-component-background-color-selected-hover)
--spectrum-actionbutton-m-textonly-background-color-selected-key-focus var(--spectrum-alias-component-background-color-selected-key-focus)
--spectrum-actionbutton-m-textonly-border-color var(--spectrum-alias-component-border-color-default)
--spectrum-actionbutton-m-textonly-border-color-disabled var(--spectrum-alias-component-border-color-disabled)
--spectrum-actionbutton-m-textonly-border-color-down var(--spectrum-alias-component-border-color-down)
--spectrum-actionbutton-m-textonly-border-color-hover var(--spectrum-alias-component-border-color-hover)
--spectrum-actionbutton-m-textonly-border-color-key-focus var(--spectrum-alias-component-border-color-key-focus)
--spectrum-actionbutton-m-textonly-border-color-selected var(--spectrum-alias-component-border-color-selected-default)
--spectrum-actionbutton-m-textonly-border-color-selected-disabled var(--spectrum-alias-component-border-color-disabled)
--spectrum-actionbutton-m-textonly-border-color-selected-down var(--spectrum-alias-component-border-color-selected-down)
--spectrum-actionbutton-m-textonly-border-color-selected-hover var(--spectrum-alias-component-border-color-selected-hover)
--spectrum-actionbutton-m-textonly-border-color-selected-key-focus var(--spectrum-alias-component-border-color-selected-key-focus)
--spectrum-actionbutton-m-textonly-border-radius var(--spectrum-alias-component-border-radius)
--spectrum-actionbutton-m-textonly-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-m-textonly-height var(--spectrum-global-dimension-size-400)
--spectrum-actionbutton-m-textonly-hold-icon-color var(--spectrum-alias-component-icon-color-default)
--spectrum-actionbutton-m-textonly-hold-icon-color-disabled var(--spectrum-alias-component-icon-color-disabled)
--spectrum-actionbutton-m-textonly-hold-icon-color-down var(--spectrum-alias-component-icon-color-down)
--spectrum-actionbutton-m-textonly-hold-icon-color-hover var(--spectrum-alias-component-icon-color-hover)
--spectrum-actionbutton-m-textonly-hold-icon-color-key-focus var(--spectrum-alias-component-icon-color-key-focus)
--spectrum-actionbutton-m-textonly-hold-icon-padding-bottom var(--spectrum-global-dimension-size-50)
--spectrum-actionbutton-m-textonly-hold-icon-padding-right var(--spectrum-global-dimension-size-50)
--spectrum-actionbutton-m-textonly-min-width var(--spectrum-global-dimension-size-400)
--spectrum-actionbutton-m-textonly-padding-left var(--spectrum-global-dimension-size-150)
--spectrum-actionbutton-m-textonly-padding-right var(--spectrum-global-dimension-size-150)
--spectrum-actionbutton-m-textonly-text-color var(--spectrum-alias-component-text-color-default)
--spectrum-actionbutton-m-textonly-text-color-disabled var(--spectrum-alias-component-text-color-disabled)
--spectrum-actionbutton-m-textonly-text-color-down var(--spectrum-alias-component-text-color-down)
--spectrum-actionbutton-m-textonly-text-color-hover var(--spectrum-alias-component-text-color-hover)
--spectrum-actionbutton-m-textonly-text-color-key-focus var(--spectrum-alias-component-text-color-key-focus)
--spectrum-actionbutton-m-textonly-text-color-selected var(--spectrum-alias-component-text-color-selected-default)
--spectrum-actionbutton-m-textonly-text-color-selected-disabled var(--spectrum-alias-component-text-color-disabled)
--spectrum-actionbutton-m-textonly-text-color-selected-down var(--spectrum-alias-component-text-color-selected-down)
--spectrum-actionbutton-m-textonly-text-color-selected-hover var(--spectrum-alias-component-text-color-selected-hover)
--spectrum-actionbutton-m-textonly-text-color-selected-key-focus var(--spectrum-alias-component-text-color-selected-key-focus)
--spectrum-actionbutton-m-textonly-text-font-weight var(--spectrum-alias-body-text-font-weight)
--spectrum-actionbutton-m-textonly-text-line-height var(--spectrum-alias-component-text-line-height)
--spectrum-actionbutton-m-textonly-text-size var(--spectrum-global-dimension-font-size-100)
--spectrum-actionbutton-s-icononly-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-s-icononly-padding-left var(--spectrum-global-dimension-size-50)
--spectrum-actionbutton-s-icononly-padding-right var(--spectrum-global-dimension-size-50)
--spectrum-actionbutton-s-quiet-textonly-border-radius var(--spectrum-alias-component-border-radius)
--spectrum-actionbutton-s-quiet-textonly-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-s-quiet-textonly-text-font-weight var(--spectrum-alias-body-text-font-weight)
--spectrum-actionbutton-s-quiet-textonly-text-size var(--spectrum-global-dimension-font-size-75)
--spectrum-actionbutton-s-texticon-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-s-texticon-icon-gap var(--spectrum-global-dimension-size-85)
--spectrum-actionbutton-s-texticon-padding-left var(--spectrum-global-dimension-size-85)
--spectrum-actionbutton-s-textonly-border-radius var(--spectrum-alias-component-border-radius)
--spectrum-actionbutton-s-textonly-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-s-textonly-height var(--spectrum-global-dimension-size-300)
--spectrum-actionbutton-s-textonly-hold-icon-padding-bottom var(--spectrum-global-dimension-size-40)
--spectrum-actionbutton-s-textonly-hold-icon-padding-right var(--spectrum-global-dimension-size-40)
--spectrum-actionbutton-s-textonly-min-width var(--spectrum-global-dimension-size-400)
--spectrum-actionbutton-s-textonly-padding-left var(--spectrum-global-dimension-size-115)
--spectrum-actionbutton-s-textonly-padding-right var(--spectrum-global-dimension-size-115)
--spectrum-actionbutton-s-textonly-text-font-weight var(--spectrum-alias-body-text-font-weight)
--spectrum-actionbutton-s-textonly-text-line-height var(--spectrum-alias-component-text-line-height)
--spectrum-actionbutton-s-textonly-text-size var(--spectrum-global-dimension-font-size-75)
--spectrum-actionbutton-xl-icononly-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-xl-icononly-padding-left var(--spectrum-global-dimension-size-160)
--spectrum-actionbutton-xl-icononly-padding-right var(--spectrum-global-dimension-size-160)
--spectrum-actionbutton-xl-quiet-textonly-border-radius var(--spectrum-alias-component-border-radius)
--spectrum-actionbutton-xl-quiet-textonly-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-xl-quiet-textonly-text-font-weight var(--spectrum-alias-body-text-font-weight)
--spectrum-actionbutton-xl-quiet-textonly-text-size var(--spectrum-global-dimension-font-size-300)
--spectrum-actionbutton-xl-texticon-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-xl-texticon-icon-gap var(--spectrum-global-dimension-size-125)
--spectrum-actionbutton-xl-texticon-padding-left var(--spectrum-global-dimension-size-185)
--spectrum-actionbutton-xl-textonly-border-radius var(--spectrum-alias-component-border-radius)
--spectrum-actionbutton-xl-textonly-border-size var(--spectrum-alias-border-size-thin)
--spectrum-actionbutton-xl-textonly-height var(--spectrum-global-dimension-size-600)
--spectrum-actionbutton-xl-textonly-hold-icon-padding-bottom var(--spectrum-global-dimension-size-75)
--spectrum-actionbutton-xl-textonly-hold-icon-padding-right var(--spectrum-global-dimension-size-75)
--spectrum-actionbutton-xl-textonly-min-width var(--spectrum-global-dimension-size-400)
--spectrum-actionbutton-xl-textonly-padding-left var(--spectrum-global-dimension-size-225)
--spectrum-actionbutton-xl-textonly-padding-right var(--spectrum-global-dimension-size-225)
--spectrum-actionbutton-xl-textonly-text-font-weight var(--spectrum-alias-body-text-font-weight)
--spectrum-actionbutton-xl-textonly-text-line-height var(--spectrum-alias-component-text-line-height)
--spectrum-actionbutton-xl-textonly-text-size var(--spectrum-global-dimension-font-size-300)
--spectrum-alias-body-text-font-family var(--spectrum-global-font-family-base)
--spectrum-alias-component-text-line-height var(--spectrum-global-font-line-height-small)

Description #

An <sp-action-button> represents an action a user can take.

Usage #

See it on NPM! How big is this package in your project? Try it on webcomponents.dev

yarn add @spectrum-web-components/action-button

Import the side effectful registration of <sp-action-button> via:

import '@spectrum-web-components/action-button/sp-action-button.js';

When looking to leverage the ActionButton base class as a type and/or for extension purposes, do so via:

import { ActionButton } from '@spectrum-web-components/action-button';

Sizes #

Small
<sp-action-group>
<sp-action-button size="s">Edit</sp-action-button>
<sp-action-button size="s">
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button size="s">
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button size="s" hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
Medium
<sp-action-group>
<sp-action-button size="m">Edit</sp-action-button>
<sp-action-button size="m">
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button size="m">
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button size="m" hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
Large
<sp-action-group>
<sp-action-button size="l">Edit</sp-action-button>
<sp-action-button size="l">
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button size="l">
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button size="l" hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
Extra Large
<sp-action-group>
<sp-action-button size="xl">Edit</sp-action-button>
<sp-action-button size="xl">
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button size="xl">
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button size="xl" hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>

Variants #

The <sp-action-button> can be customized with either or both of the emphasized and quiet attributes. These will pair with either or both of the state attributes (selected and disabled) to decide the final visual delivery of the <sp-action-button>. Content addressed to the icon slot can also be provided and will be positioned just before the rest of the the supplied button content.

Standard #

<div
style="display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2em;"
>

<div>
<sp-field-label for="standard">Default</sp-field-label>
<sp-action-group id="standard">
<sp-action-button>Edit</sp-action-button>
<sp-action-button>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>

<div>
<sp-field-label for="standard-selected">Selected</sp-field-label>
<sp-action-group id="standard-selected">
<sp-action-button selected>Edit</sp-action-button>
<sp-action-button selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button selected hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>

<div>
<sp-field-label for="standard-disabled">Disabled</sp-field-label>
<sp-action-group id="standard-disabled">
<sp-action-button disabled>Edit</sp-action-button>
<sp-action-button disabled>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button disabled>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button disabled hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>

<div>
<sp-field-label for="standard-disabled-selected">
Disabled + Selected
</sp-field-label>
<sp-action-group id="standard-disabled-selected">
<sp-action-button disabled selected>Edit</sp-action-button>
<sp-action-button disabled selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button disabled selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button disabled selected hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>
</div>

Quiet #

<div
style="display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2em;"
>

<div>
<sp-field-label for="standard">Default</sp-field-label>
<sp-action-group quiet id="standard">
<sp-action-button quiet>Edit</sp-action-button>
<sp-action-button quiet>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button quiet>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button quiet hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>

<div>
<sp-field-label for="standard-selected">Selected</sp-field-label>
<sp-action-group quiet id="standard-selected">
<sp-action-button quiet selected>Edit</sp-action-button>
<sp-action-button quiet selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button quiet selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button quiet selected hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>

<div>
<sp-field-label for="standard-disabled">Disabled</sp-field-label>
<sp-action-group quiet id="standard-disabled">
<sp-action-button quiet disabled>Edit</sp-action-button>
<sp-action-button quiet disabled>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button quiet disabled>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button quiet disabled hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>

<div>
<sp-field-label for="standard-disabled-selected">
Disabled + Selected
</sp-field-label>
<sp-action-group quiet id="standard-disabled-selected">
<sp-action-button quiet disabled selected>Edit</sp-action-button>
<sp-action-button quiet disabled selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button quiet disabled selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button quiet disabled selected hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>
</div>

Emphasized #

<div
style="display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2em;"
>

<div>
<sp-field-label for="standard">Default</sp-field-label>
<sp-action-group emphasized id="standard">
<sp-action-button emphasized>Edit</sp-action-button>
<sp-action-button emphasized>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button emphasized>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button emphasized hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>

<div>
<sp-field-label for="standard-selected">Selected</sp-field-label>
<sp-action-group emphasized id="standard-selected">
<sp-action-button emphasized selected>Edit</sp-action-button>
<sp-action-button emphasized selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button emphasized selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button emphasized selected hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>

<div>
<sp-field-label for="standard-disabled">Disabled</sp-field-label>
<sp-action-group emphasized id="standard-disabled">
<sp-action-button emphasized disabled>Edit</sp-action-button>
<sp-action-button emphasized disabled>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button emphasized disabled>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button emphasized disabled hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>

<div>
<sp-field-label for="standard-disabled-selected">
Disabled + Selected
</sp-field-label>
<sp-action-group emphasized id="standard-disabled-selected">
<sp-action-button emphasized disabled selected>
Edit
</sp-action-button>
<sp-action-button emphasized disabled selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button emphasized disabled selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button emphasized disabled selected hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>
</div>

Emphasized + Quiet #

<div
style="display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2em;"
>

<div>
<sp-field-label for="standard">Default</sp-field-label>
<sp-action-group emphasized quiet id="standard">
<sp-action-button emphasized quiet>Edit</sp-action-button>
<sp-action-button emphasized quiet>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button emphasized quiet>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button emphasized quiet hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>

<div>
<sp-field-label for="standard-selected">Selected</sp-field-label>
<sp-action-group emphasized quiet id="standard-selected">
<sp-action-button emphasized quiet selected>Edit</sp-action-button>
<sp-action-button emphasized quiet selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button emphasized quiet selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button emphasized quiet selected hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>

<div>
<sp-field-label for="standard-disabled">Disabled</sp-field-label>
<sp-action-group emphasized quiet id="standard-disabled">
<sp-action-button emphasized quiet disabled>Edit</sp-action-button>
<sp-action-button emphasized quiet disabled>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button emphasized quiet disabled>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button emphasized quiet disabled hold-affordance>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>

<div>
<sp-field-label for="standard-disabled-selected">
Disabled + Selected
</sp-field-label>
<sp-action-group emphasized quiet id="standard-disabled-selected">
<sp-action-button emphasized quiet disabled selected>
Edit
</sp-action-button>
<sp-action-button emphasized quiet disabled selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
Edit
</sp-action-button>
<sp-action-button emphasized quiet disabled selected>
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-action-button
emphasized
quiet
disabled
selected
hold-affordance
>

<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
</sp-action-group>
</div>
</div>

Action button with hold affordance #

The use of the hold-affordance attribute signifies that the <sp-action-button> in question will be delivered with a visual affordance outlining that special interaction with the button will dispatch a longpress event. Via a pointer input, this even will be dispatched when 300ms has passed after a pointerdown event without the presence of a pointerup or pointercancel event. Via the keyboard, an event with a code of Space or or ArrowDown while altKey === true will dispatch the event.

<div
style="display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2em;"
>

<overlay-trigger placement="bottom-start">
<sp-action-button label="Edit" hold-affordance slot="trigger">
<sp-icon-edit slot="icon"></sp-icon-edit>
</sp-action-button>
<sp-popover slot="longpress-content" dialog tip>
<p
style="color: var(--spectrum-body-m-text-color,var(--spectrum-alias-text-color));"
>

This content is triggered by the "longpress" interaction.
</p>
</sp-popover>
</overlay-trigger>

<overlay-trigger placement="top">
<sp-action-button hold-affordance quiet slot="trigger">
Show Longpress Content
</sp-action-button>
<sp-popover slot="longpress-content" dialog tip>
<p
style="color: var(--spectrum-body-m-text-color,var(--spectrum-alias-text-color));"
>

This content is triggered by the "longpress" interaction.
</p>
</sp-popover>
</overlay-trigger>

<overlay-trigger placement="top-end">
<sp-action-button hold-affordance selected slot="trigger">
<sp-icon-edit slot="icon"></sp-icon-edit>
Extended Content with Longpress
</sp-action-button>
<sp-popover slot="longpress-content" dialog tip>
<p
style="color: var(--spectrum-body-m-text-color,var(--spectrum-alias-text-color));"
>

This content is triggered by the "longpress" interaction.
</p>
</sp-popover>
</overlay-trigger>
</div>

Toggles #

With the application of the toggles attribute, the button will self manage its selected property on click. When this value is updated, a cancellable change event will be dispatched to inform the parent application.

<div
style="display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 2em;"
>

<div>
<sp-field-label for="toggles-default">Standard</sp-field-label>
<sp-action-button toggles id="toggles-default">
Toggle button
</sp-action-button>
</div>
<div>
<sp-field-label for="toggles-quiet">Quiet</sp-field-label>
<sp-action-button toggles quiet id="toggles-quiet">
Toggle button
</sp-action-button>
</div>
<div>
<sp-field-label for="toggles-emphasized">Emphasized</sp-field-label>
<sp-action-button toggles emphasized id="toggles-emphasized">
Toggle button
</sp-action-button>
</div>
<div>
<sp-field-label for="toggles-emphasized-quiet">
Emphasized + Quiet
</sp-field-label>
<sp-action-button
toggles
emphasized
quiet
id="toggles-emphasized-quiet"
>

Toggle button
</sp-action-button>
</div>
</div>