Ask Natuna

Ask about the design system

Hi, I am Natuna.

Ask me about the design system: components, tokens, statuses, and how to use them.

Natuna can be wrong. The docs are the source of truth.

Skip to content
  • IntroductionPage
  • Ask NatunaAsk about the design systemPage
  • FoundationColor, type, number, effectPage
  • Components overviewPage
  • ThemesLight and dark modePage
  • NamingProperty and page namesPage
  • Privacy statementPage
  • Text-safe stepsFirst AA and AAA step per color rampSection
  • AccessibilityWCAG 2.2 AAA rulesSection
  • Dark modeThemesSection
  • Using it todayFigma file and React codeSection
  • Component statusDesign status and In ReactSection

Arrow keys to move, Enter to open, Esc to close.

Button

Trigger an action or event, such as submitting a form or opening a dialog.

Status
Ready
Code
In React
Role
Action

Usage

This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.

Pastes as editable layers. Shadows are not exported.

import { useState } from "react";
import { Button } from "@/ui";

export default function ButtonDemo() {
  const [saving, setSaving] = useState<boolean>(false);
  const [deleting, setDeleting] = useState<boolean>(false);

  function run(set: (busy: boolean) => void): void {
    set(true);
    setTimeout(() => set(false), 1500);
  }

  return (
    <>
      <Button loading={saving} onClick={() => run(setSaving)}>Save changes</Button>
      <Button variant="secondary">Export</Button>
      <Button variant="ghost">Cancel</Button>
      <Button variant="destructive" loading={deleting} onClick={() => run(setDeleting)}>
        Delete account
      </Button>
      <Button size="lg">Pay Rp 412.500</Button>
      <Button disabled>Unavailable</Button>
    </>
  );
}

Variants and states

Every specimen is the real component from src/ui, held in one state.

variant primarydefault, disabled, loading
variant secondarydefault, disabled, loading
variant ghostdefault, disabled, loading
variant destructivedefault, disabled, loading
variant inversedefault, disabled, loading
size mdAt least 44px tall
size lgAt least 48px tall
  • These buttons are live but do nothing. Hover one, or Tab to it to see the focus outline.
  • Hover changes the fill: brand-hover for primary, gray-200 for secondary, gray-50 for ghost, danger-hover for destructive, inverse-raised for inverse.
  • Disabled looks the same for every variant: a gray-100 fill with gray-500 text. Disabled controls are exempt from the text contrast rule.
  • Loading keeps the variant color and the width, hides the label visually, and shows a spinner.

Pastes as editable layers. Shadows are not exported.

Props

variant
"primary" | "secondary" | "ghost" | "destructive" | "inverse" · default "primary"
Visual weight. Use one primary per view. Inverse is the near-black page-ink fill (near white in dark mode) for the main action on marketing and landing pages.
size
"md" | "lg" · default "md"
md is at least 44px tall, lg at least 48px. Both clear the 44px touch target.
children
ReactNode · default none
The label. An icon goes here too, before or after the text, and is spaced 8px from it.
loading
boolean · default false
Shows a spinner over the label, sets aria-busy and aria-disabled, and blocks clicks. The button keeps its size, its color, and keyboard focus.
disabled
boolean · default false
The native disabled attribute. Blocks interaction, removes the button from the Tab order, and uses the disabled colors.
type
"button" | "submit" | "reset" · default "button"
Defaults to button so a button inside a form does not submit by accident.
className
string · default ""
Extra classes, added after the variant and size classes.
...rest
ButtonHTMLAttributes · default none
Every other native button attribute, such as onClick and aria-label. They are spread last, so an aria-disabled or aria-busy you pass replaces the one loading sets.

Figma to code

Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.

🧰 Type
variant
Closest match. Naming defines Type as the structural kind; variant sets the visual weight. Destructive is a variant value in code, while Naming rule 4 puts color roles under Tone.
📐 Size
size
md and lg.
🎯 State
None
No prop. Hover, focus, and pressed come from the browser at runtime. Disabled is the disabled prop and loading is the loading prop.
🖍 Label
children
The text inside the button.
◀️ Show Icon Left, 🖼 Change Icon Left
children
No icon prop yet. Put the icon in children before the text, with aria-hidden.
▶️ Show Icon Right, 🖼 Change Icon Right
children
No icon prop yet. Put the icon in children after the text, with aria-hidden.
🎨 Tone
None
No prop yet. The destructive color is a variant value.

Accessibility

What the code in src/ui does today, and what it leaves to you.

Keyboard

  • Tab moves focus to the button. Enter and Space press it. Both come from the native button element.
  • A disabled button uses the native disabled attribute, so Tab skips it.
  • A loading button stays in the Tab order and keeps focus while it loads and after. Presses are ignored until loading ends, and a submit button does not submit.

Screen readers

  • Announced as a button, named by its children text.
  • While loading, the label stays in the accessibility tree (it is only made transparent), so the name does not change. aria-disabled="true" makes it read as unavailable, and aria-busy="true" is set. The spinner is aria-hidden.
  • Support for aria-busy varies between screen readers, so the start and end of loading may not be announced.

What you still need to do

  • Give an icon-only button an aria-label, and mark the icon aria-hidden.
  • Announce the result of a slow action yourself, for example with a status message, because the end of loading is silent.
  • Pass type="submit" for a form's submit button. The default is button.
  • This component draws no focus indicator of its own. On this site a global :focus-visible rule draws a 2px outline in the border/focus role (--color-role-border-focus). Copy the role tokens and that rule, or an equivalent, into your app.

When to use

Buttons run actions: submitting a form, confirming a choice, opening a dialog, or starting a process. To move to another page, use a Link, styled as a button only when it is the main call to action.

Do and don't

Do

  • Reserve primary for the single most important action in the view. Use secondary or ghost for everything else.
  • Write labels that describe the action ("Save changes", "Delete account"). Avoid vague labels like "OK" or "Click here".
  • Show a loading state for actions that take time, like saving or submitting, so the user knows it is working.

Don't

  • Place more than one primary button in the same view: this dilutes the visual hierarchy.
  • Use the destructive variant without a confirmation step for irreversible actions like deleting data.
  • Use a button for navigation. If it only takes the user to another page, use a link instead.

4 of 16 other atoms, same role and ready ones first.

See all components

Status reflects the component tracker snapshot of 29 October 2026.