Skip to content
GitHub (opens in a new tab)

Button

Clickable action control with appearance × mode (plus an optional flat set) and a fixed set of sizes.

stableAtomcontracts/button.json

Preview

Buttons

Appearance × mode: solid, outline, soft, ghost across primary, neutral, and danger. Optional flat set drops elevation. One solid-primary CTA per view. Lucide icon slots via iconStart and iconEnd. Heights are 32, 36 and 40, the same as Input, Select and FilterButton. Icon-only is a square of that height and needs aria-label; IconButton is the typed export for it.

Master

A solid primary Button at md. Variants shows every appearance, mode, flat, icon and state.

Usage

One appearance="solid" mode="primary" Button per view. Neutral outline for cancel and alternate paths, ghost for toolbars, danger only for irreversible work. Flat drops the resting shadow so a white control still reads on a white card. Pass Lucide export names on iconStart and iconEnd. Icon-only omits children and must set ariaLabel. Set loading while the action runs: the label stays, a spinner takes the leading icon slot, the width holds, and clicks are ignored.

Do's

  • Submitting a form or triggering a primary workflow action
  • Offering a quieter action alongside content (outline, soft, or ghost)
  • Destructive actions that need explicit danger styling
  • Toolbar or compact actions with a Lucide icon and a visible label
  • Icon-only actions when space is tight — use IconButton, the typed export that requires an icon and ariaLabel
  • An Ask action that opens the assistant: appearance outline, mode neutral, size sm, iconStart MessageCircle, label Ask

Don'ts

  • Navigation to another page or site — use Link (inline, standalone or external)
  • Icon-only without aria-label — icon-only must set ariaLabel
  • More than one solid-primary button in the same view
<Button
  appearance="solid"
  mode="primary"
  size="md"
>
  Continue
</Button>

When to use

  • Submitting a form or triggering a primary workflow action
  • Offering a quieter action alongside content (outline, soft, or ghost)
  • Destructive actions that need explicit danger styling
  • Toolbar or compact actions with a Lucide icon and a visible label
  • Icon-only actions when space is tight — use IconButton, the typed export that requires an icon and ariaLabel
  • An Ask action that opens the assistant: appearance outline, mode neutral, size sm, iconStart MessageCircle, label Ask

When not to use

  • Navigation to another page or site — use Link (inline, standalone or external)
  • Icon-only without aria-label — icon-only must set ariaLabel
  • More than one solid-primary button in the same view

What an agent reads

import { Button } from "agentic-ds-kit";
must
  • Visible label via children, OR aria-label for icon-only
  • Decorative icons are aria-hidden
  • disabled sets aria-disabled and prevents interaction
  • loading sets aria-busy and aria-disabled, keeps focus and the accessible name, and ignores clicks
  • Danger is never colour alone: a labelled solid, outline or soft danger Button always has a leading icon
  • Focus ring must be visible on keyboard focus
  • Press sinks the button a little (scale) and it settles back on the exit motion timing. No motion under prefers-reduced-motion
defaults
  • size md
  • appearance solid
  • mode primary
  • flat false
  • disabled false
  • loading false
  • type button
  • shape default
  • block false
stops if
  • Do not invent local Button appearances or modes outside the enums
  • Do not use raw hex colors in styles
  • Do not place more than one appearance=solid mode=primary Button in a single view
  • Do not pass custom SVG markup as icons — use a Lucide name or Lucide component on iconStart/iconEnd
  • Do not ship icon-only without ariaLabel
  • Do not build a local Ask button or IconButton — Ask is a neutral sm Button with a MessageCircle icon, and IconButton is the kit export
  • Do not swap the label for a spinner or disable the button while it works — set loading

From contracts/button.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
draggablebooleanNo—Native drag source. Use with onDragStart/onDragEnd, e.g. a chip that drags into a list.
onDragStartfunctionNo—(event: DragEvent<HTMLButtonElement>) => void. Set dataTransfer here.
onDragEndfunctionNo—(event: DragEvent<HTMLButtonElement>) => void.
sizelg | md | smNomdHeights from control-height: sm 32, md 36, lg 40, the same as Input, Select and FilterButton. Icon-only is a square of that height.
appearancesolid | outline | soft | ghostNosolid—
modeprimary | neutral | dangerNoprimary—
flatbooleanNofalseFlat set: no elevation. Combine with solid, outline, or soft (ghost is coerced to soft).
disabledbooleanNofalseUses text-fg-disabled, border-disabled and surface-muted. Ghost keeps no fill.
loadingbooleanNofalseThe action is running. Sets aria-busy, shows a spinner in the leading icon slot, keeps the label and ignores clicks. The button stays focusable. disabled wins when both are set.
childrenstringNo—required unless icon-only
iconStartKitIconNo—A curated Lucide name (PascalCase or kebab-case) renders instantly; any other Lucide name needs import "agentic-ds-kit/icons-on-demand" once (otherwise it is skipped with a dev warning). Or pass the Lucide component (Plus) or an element. Left empty on a labelled solid, outline or soft danger Button, it defaults to TriangleAlert so danger is not colour alone; pass Trash2 for a delete.
iconEndKitIconNo—A curated Lucide name (PascalCase or kebab-case) renders instantly; any other Lucide name needs import "agentic-ds-kit/icons-on-demand" once (otherwise it is skipped with a dev warning). Or pass the Lucide component (Plus) or an element.
shortcutstringNo—Visual key hint after the label, e.g. "⏎", "Esc", "⌘⏎". aria-hidden: wire the key yourself and set aria-keyshortcuts. Hidden on touch screens and below --grid-breakpoint-sm. Ignored when icon-only.
ariaLabelstringNo—required when children is omitted (icon-only)
onClickfunctionNo——
typebutton | submit | resetNobutton—
shapedefault | pillNodefaultpill uses radius-pill. Drawer footers use pill.
blockbooleanNofalseFull width of the parent.
  • Component
    →

    Link

    Text that navigates to another page or place: inline inside a sentence, standalone on its own line, or an announcement chip, with an external variant that opens a new tab.