Aliases
cta, action button
components / button
Primary action control with compiled variants, size recipes, loading behavior, and proof-backed interaction states.
Playground
Start here. Switch systems, interact with the shipped component, and let the rest of the page answer the why and how after the behavior clicks.
Cobalt
The crisp default DK action system: bright primary, roomy spacing, and a direct editorial rhythm.
Overview
This section explains the intent of the component before the implementation details.
Aliases
cta, action button
Explore the math
Decision guide
Use these notes to decide quickly whether this is the right DK component for the job.
Decision guide
Do
Do not
Usage
Prefer these situations when choosing this component.
Usage
These patterns are better served by a different component or a simpler surface.
Anti-patterns
Migration notes
Anatomy
The anatomy explains which pieces matter to the recipe and accessibility model.
interactive container
rootCarries the main action styling, spacing, and state transitions.
text label
labelCommunicates the action in plain language.
supporting icon slot
leadingAdds emphasis or direction before the label.
supporting icon slot
trailingAdds continuation or disclosure after the label.
loading indicator
spinnerReplaces the icon/leading slot during loading states.
API
The docs contract distinguishes props, DOM events, and slots so integration behavior is explicit.
Props
| Name | Type | Default | Description |
|---|---|---|---|
variant | 'solid' | 'soft' | 'outline' | 'ghost' | 'link' | 'destructive' | 'solid' | Chooses the visual action recipe. |
size | 'xs' | 'sm' | 'md' | 'lg' | 'md' | Chooses the compiled size recipe. |
href | string | — | When provided, renders the button as an anchor element. |
as | 'button' | 'a' | 'button' | Explicitly chooses the underlying interactive element. |
type | 'button' | 'submit' | 'reset' | 'button' | Native button type when rendered as a button. |
disabled | boolean | false | Disables activation and updates semantics accordingly. |
loading | boolean | false | Shows the loading state and suppresses activation. |
iconOnly | boolean | false | Switches the component into icon-only mode. |
ariaLabel | string | — | Required accessible label when `iconOnly` is true. |
target | string | — | Anchor target when rendering as a link. |
rel | string | — | Anchor relationship attributes when rendering as a link. |
theme | ThemeContract | — | Overrides the compiled DK theme used to resolve tokens and recipes for this component. |
Slots
| Name | Description |
|---|---|
default | Primary visible label content. |
leading | Optional icon or symbol before the label. |
trailing | Optional icon or symbol after the label. |
Recipes
These notes summarize the intended recipe surface rather than exposing raw implementation detail first.
Variants
Sizes
States
Accessibility
This is the behavior the component promises to assistive tech and keyboard users today.
Semantics
Keyboard
Screen readers
Caveats
Checklist
Implementation
This section shows the representative compiled slot variables that the runtime consumes for the selected design system.
Implementation notes
Implementation checklist
Examples
Each example is intentionally practical, grouped by starter, common pattern, and edge-case coverage.
Starter
1 example
starter
Starter: primary actionThe default solid medium button for the main next step.
Copy snippet
<Button variant="solid" size="md">Continue</Button>Common patterns
1 example
common
Common: destructive loading actionUse destructive plus loading when the outcome is risky and asynchronous.
Copy snippet
<Button variant="destructive" loading={true}>Delete project</Button>Edge cases
1 example
edge
Edge: icon-only affordanceIcon-only mode keeps the target size while shrinking the visual footprint.
Copy snippet
<Button variant="ghost" iconOnly={true} ariaLabel="Open settings">⚙</Button>Verification
Proofs stay visible in the docs so the system shows what it can guarantee, not just what it can render.
content=label|size=md|variant=solid
content=label|size=md|variant=soft
content=label|size=md|variant=outline
content=label|size=md|variant=ghost
content=label|size=md|variant=link
content=label|size=md|variant=destructive
content=label|size=xs|variant=solid
content=label|size=sm|variant=solid
content=label|size=lg|variant=solid
content=icon-only|size=md|variant=solid
content=icon-only|size=lg|variant=solid
content=label|size=md|variant=destructive
content=label|size=md|variant=link