Button

A button triggers an event or action. They let users know what will happen next.

Neutral selected states

When the platform-dst-tokens-finesse feature flag is enabled, this component uses the new neutral treatment for selected states.

Installation

Package installation information
Installyarn add @atlaskit/button
SourceBitbucket.org, (opens new window)
npm@atlaskit/button, (opens new window)
Bundleunpkg.com, (opens new window)

Props

Each button type also supports its respective HTML element attributes, except for:

  • disabled (use isDisabled instead)
  • style
  • role

analyticsContext

Description

Additional information to be included in the context of Atlaskit analytics events that come from button. See the pressable or anchor primitive code examples for more information.

Type{ [x: string]: any; }

appearance

Description

The button style variation.

Type"default" | "danger" | "primary" | "rovo" | "subtle" | "warning" | "discovery"

autoFocus

Description

Set the button to autofocus on mount.

Typeboolean

children

Required
Description

Text content to be rendered in the button.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

data-testid

Description
No description.
Typenever

iconAfter

Description

Places an icon within the button, after the button's text.

TypeComponentClass<Omit<IconProps, "size"> | Omit<NewIconProps, "spacing" | "size">, any> | FunctionComponent<Omit<IconProps, "size"> | Omit<...>>

iconBefore

Description

Places an icon within the button, before the button's text.

TypeComponentClass<Omit<IconProps, "size"> | Omit<NewIconProps, "spacing" | "size">, any> | FunctionComponent<Omit<IconProps, "size"> | Omit<...>>

interactionName

Description

An optional name used to identify the button to interaction content listeners. By default, button fires React UFO (Unified Frontend Observability) press interactions for available listeners. This helps Atlassian measure performance and reliability. See the pressable or anchor primitive code examples for more information.

Typestring

isDisabled

Description

Disable the button to prevent user interaction.

Typeboolean

isLoading

Description

Conditionally show a spinner over the top of a button

Typeboolean

isSelected

Description

Indicates that the button is selected.

Typeboolean

onBlur

Description

Handler called on blur.

Type(event: FocusEvent<HTMLButtonElement, Element>) => void

onClick

Description

Handler called on click. You can use the second argument to fire Atlaskit analytics events on custom channels. They could then be routed to GASv3 analytics. See the pressable or anchor primitive code examples for information on firing Atlaskit analytics events or routing these to GASv3 analytics.

Type(e: MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void

onFocus

Description

Handler called on focus.

Type(event: FocusEvent<HTMLButtonElement, Element>) => void

ref

Description
No description.
Type((instance: HTMLButtonElement) => void) | RefObject<HTMLButtonElement>

shouldFitContainer

Description

Option to fit button width to its parent width.

Typeboolean

spacing

Description

Controls the amount of padding in the button.

Type"compact" | "default"

testId

Description

A unique string that appears as data attribute data-testid in the rendered code, serving as a hook for automated tests.

Typestring
Was this page helpful?
We use this feedback to improve our documentation.
© 2026 AtlassianTrademark, (opens new window)Privacy, (opens new window)License