Job board

Button

A button triggers an action or a navigation. The Role axis sets hierarchy — Primary for the main action in a context, Secondary for supporting ones — and Size (lg, md, sm) matches the density of its surroundings.

Design
Finished
Level
Draft
Audit
5 open findingsat the audit of
Last changed

Preview

Button, default variant as designedButton, default variant as designed
Default variant as designed, light modedark modeOpen in Figma

Usage

Do

  • Choose Role first, then Size to match surrounding density
  • Limit Primary to one per context
  • Set the label through Label text

Don't

  • Use two Primary buttons in the same context
  • Use a button for a plain in-page link: use a link
  • Disable a button without saying why the action is unavailable

Behaviour

  • Icon reveals a leading icon, supplied through Icon swap
  • State (Focus, Hover, Press) and Disabled are managed by code and not applied in static designs

Composition

  • The icon is supplied through the Icon swap prop and revealed by the Icon boolean; import the icon component rather than redrawing it

Accessibility

Follows the WAI-ARIA button pattern: roles, keyboard and focus behaviour.

Dependencies in Figma

Built fromUsed bySpinnerSpinnerButtonButton_Modal - dialog_Modal - dialogBottom navigationBottom navigationEmpty stateEmpty stateNewsletter blockNewsletter blockTop navigationTop navigation

Places 1 component from another library: Icon/plus / Size=20. This snapshot does not hold them, so this page cannot link to them or describe them.

Level checks

Draft · next level blocked by Errors open

The ladder's checks for Button
CheckLevelResult
AuditedReadyPasses
No errors openReady4 errors open
Has a descriptionReadyPasses
Usage and Don't writtenReadyChecked at the next audit
Every layer namedReadyPasses
In codeReadyPasses
No warnings openStableNot yet
Code gen notes writtenStableChecked at the next audit
Auto layout throughoutStableChecked at the next audit
Matches the designStablePasses

Anatomy

12
Every option switched on: what the component can contain, not how it is usually used
#PartShownComponent
1IconBy Iconplus
2LabelAlways–

Properties

Button: each property, its type, values and default
PropertyTypeValuesDefault
SizeVariant
lgmdsm
lg
RoleVariant
PrimarySecondary
Primary
DisabledVariant
FalseTrue
False
StateVariant
RestFocusHoverPressLoading
Rest
IconBooleantrue, falsefalse
Label textTextany textLabel
1 instance swap (icons and parts a designer can replace)
  • Icon swap

States

StateSet by
FocusInteraction
HoverInteraction
PressInteraction
LoadingThe State property
DisabledThe Disabled property

Implementation

What code builds differently from the drawing, and why
FigmaCodeWhy
Focus ring, a layer 4px outside the boxoutline on :focus-visible, outline-offset 4px less the ring's widthFigma has no focus state, so it draws the ring as a layer; in code it is not an element.
Spinner, absolute positionposition: absolute in a positioned parentOut of the flow: it neither pushes siblings nor sizes the parent.
Container, inside strokeborder with box-sizing: border-box and padding less the stroke, or box-shadow: inset 0 0 0 <width>Figma's inside stroke takes no space; a border does.
Roleappearancerole is ARIA's: role="primary" would tell a screen reader the element has a role by that name.
Disableddisabled, or aria-disabled where it must stay focusableThe element's own state: the browser keeps it out of the tab order and out of form submission.
State: Focus, Hover, Press:focus-visible, :hover, :activePseudo-classes the browser sets, so a template cannot claim a state the control is not in. Loading is not a pointer state and stays a property.

Changes on 23 Nov
ChangeTypeFigma filesCodeDetails
Container: fillRestyledMinorMinor

Changes on 4 Nov
ChangeTypeFigma filesCodeDetails
Container: width · 6 variantsRestyledBreakingMinor
Content: width · 4 variantsRestyledBreakingMinor
Content: height · 2 variantsRestyledBreakingMinor
Content: position · 3 variantsRestyledBreakingMinor
Label: width · 2 variantsRestyledBreakingMinor
Label: height · 2 variantsRestyledBreakingMinor
Button: width · 6 variantsRestyledBreakingMinor
Focus ring: width · 6 variantsRestyledBreakingMinor
Spinner: position · 2 variantsRestyledBreakingMinor
Label: position · 2 variantsRestyledBreakingMinor
Label: text styleRestyledMinorMinor
Label: line heightRestyledMinorMinor
Label: letter spacingRestyledMinorMinor

Changes on 13 Oct
ChangeTypeFigma filesCodeDetails
Layer IconRemovedBreakingMinor
Container: widthRestyledBreakingMinor
Content: positionRestyledBreakingMinor
Button: widthRestyledBreakingMinor
Property linksNot gradedNot gradedNot graded
Property StateAddedMinorMinor
VariantsAddedMinorMinor
Layer ContentRenamedPatchMinor
Layer ContainerAddedMinorPatch
Layer IconAddedMinorPatch
Button: width · 3 variantsRestyledBreakingMinor
Focus ring: width · 2 variantsRestyledBreakingMinor

Changes on 19 Sept
ChangeTypeFigma filesCodeDetails
DescriptionDocsPatchPatch

Changes on 6 Sept
ChangeTypeFigma filesCodeDetails
Content: strokeRestyledMinorMinor

Changes on 1 Sept
ChangeTypeFigma filesCodeDetails
Label: height · 2 variantsRestyledMinorMinor
Label: position · 3 variantsRestyledMinorMinor
Label: line heightRestyledMinorMinor
Content: strokeRestyledMinorMinor

Changes on 25 Aug
ChangeTypeFigma filesCodeDetails
Content: strokeRestyledMinorMinor
Content: strokeSidesRestyledMinorMinor
Content: stroke alignmentRestyledMinorMinor
Content: effect styleRestyledMinorMinor

Changes on 22 Aug
ChangeTypeFigma filesCodeDetails
Content: fill · 3 variantsRestyledMinorMinor

Changes on 21 Aug
ChangeTypeFigma filesCodeDetails
Content: strokeRestyledMinorMinor
Content: strokeSidesRestyledMinorMinor
Content: stroke alignmentRestyledMinorMinor
Content: clippingRestyledMinorMinor
Content: effect styleRestyledMinorMinor
Variants addedNot gradedNot gradedNot graded
Its values movedRestyledMinorMinor
ComponentAddedMinorMinor