apx-dsv0.1Local renderer · live
K
Foundations4
  • Getting started
  • Theming
  • Templates
  • Icons
  • Avatar
  • Badge
  • DataGrid
  • Scheduler
  • Stat
  • Table
  • Timeline
  • TreeView
  • Accordion
  • Alert
  • EmptyState
  • Progress
  • Skeleton
  • Spinner
  • SplashScreen
  • Toast
  • ColorPicker
  • FileUpload
  • Form
  • Rating
  • TagsInput
  • Combobox
  • Field
  • Select
  • Toggle
  • Button
  • Calendar
  • Checkbox
  • DatePicker
  • Input
  • NumberInput
  • Radio
  • Slider
  • Switch
  • Textarea
  • AppShell
  • Div
  • Divider
  • Sidebar
  • Stack
  • Typography
  • Image
  • Breadcrumbs
  • Carousel
  • NavigationMenu
  • Pagination
  • Stepper
  • Tabs
  • Toolbar
  • CommandPalette
  • Confirm
  • Drawer
  • HoverCard
  • Menu
  • Modal
  • Popover
  • Tooltip
  • Icon
  • Card
  • PricingCard
60 componentsapx-ds/renderer
Button
Variant↳ other

Inputs

Button

Triggers an action or event. The reference component for apx-ds — exercises variants, sizes, colors, polymorphism, icons, loading, disabled, animation, RTL, and theme overrides.

Overview

<Button /> is the canonical interactive primitive. Use it to trigger an action — submit a form, open a dialog, advance a flow, etc. Buttons are intentionally stateful (loading, disabled) and polymorphic (asChild), so they cover everything from a plain submit to a styled <a> link.

Overview — variant × color × icon at a glance

Loading preview…
Overview.tsx

Variants

Three stylistic families ship out of the box. Pick the one that matches the action's importance hierarchy on the page:

  • solid — opaque fill, contrast text. The primary call-to-action. Use one per region.
  • outline — transparent fill, 1px colored border, colored text. Secondary actions ("Cancel" next to "Save"). Pairs gracefully with a solid sibling without competing for attention.
  • ghost — no fill, no border, colored text. Tertiary / in-line / utility actions (toolbar buttons, "Show more", inline edits). The least visually heavy variant.

Every variant works with every color and every theme variant (default / tetsu / origami / katana) and adapts to the active platform. All hover, active, and focus states reference semantic palette tokens, so a single Theme-Studio edit re-paints the entire grid.

Anatomy

A Button is composed of three optional slots arranged inline:

text
[ leftIcon | label | rightIcon ]
[ leftIcon | label | rightIcon ]

When loading is true, the left slot is replaced by a spinning indicator and the label is optionally swapped with loadingText for assistive tech.

Examples

Basic

Loading preview…
Basic.tsx

Variants

Loading preview…
Variants.tsx

Sizes

Loading preview…
Sizes.tsx

Colors

Loading preview…
Colors.tsx

OutlineColors

Loading preview…
OutlineColors.tsx

GhostColors

Loading preview…
GhostColors.tsx

VariantMatrix

Loading preview…
VariantMatrix.tsx

WithIcons

Loading preview…
WithIcons.tsx

Loading

Loading preview…
Loading.tsx

Disabled

Loading preview…
Disabled.tsx

FullWidth

Loading preview…
FullWidth.tsx

AsChild

Loading preview…
AsChild.tsx

Props

PropTypeDefaultDescription
asChildboolean—Radix-style polymorphism. When `true`, Button merges its props/className/ref onto the single child element (e.g. wrap an `<a>` to render as a styled link).
colorResponsiveValue<ButtonColor>'primary'Semantic palette role driving fill / text / focus-ring colors.
fullWidthResponsiveValue<boolean>falseStretch to fill the parent's inline-size.
iconOnlyboolean—Force the square icon-only layout. Inferred automatically when `children` is empty and at least one of `leftIcon` / `rightIcon` is provided. Requires `aria-label`.
leftIconReactNode—Element rendered before the label (e.g. an icon). Visually swaps with `rightIcon` in RTL.
loadingboolean—When `true`, blocks interaction, sets `aria-busy`, and shows a spinner.
loadingTextstring—Optional label rendered (and announced) in place of `children` while loading.
rightIconReactNode—Element rendered after the label.
sizeResponsiveValue<ButtonSize>'md'Visual height + horizontal padding.
sxSx—Theme-aware inline style object (resolves palette / spacing / radius tokens to CSS vars).
variantResponsiveValue<ButtonVariant>'solid'Stylistic family.

Accessibility

  • Renders a native <button> by default — Space and Enter activate, focus is keyboard-visible.
  • disabled and loading both set aria-disabled and block onClick. While loading, the button also gets aria-busy="true" and a cursor-progress hint.
  • The spinner is role="status" with an aria-label of loadingText ?? "Loading".
  • asChild lets you wrap any element (an <a>, a router <Link>, …) — Button hands all props/className/ref through Slot so the child keeps its native role.
  • iconOnly (explicit or inferred when children is empty) requires aria-label. A dev-mode warning fires from the engine when it's missing.

Theming

Every visual decision is a token. Pull on the <ThemeProvider> knobs to remix the whole library at once, or scope overrides to Button specifically:

tsx
<ThemeProvider
  theme={defineTheme({
    components: {
      Button: {
        styleOverrides: {
          root: 'tracking-wide uppercase',
        },
      },
    },
  })}
>
  {children}
</ThemeProvider>
<ThemeProvider
  theme={defineTheme({
    components: {
      Button: {
        styleOverrides: {
          root: 'tracking-wide uppercase',
        },
      },
    },
  })}
>
  {children}
</ThemeProvider>

Component-level overrides win via tailwind-merge:

tsx
<Button className="border-2 border-dashed" sx={{ radius: 'lg' }} style={{ minWidth: 200 }}>
  Custom
</Button>
<Button className="border-2 border-dashed" sx={{ radius: 'lg' }} style={{ minWidth: 200 }}>
  Custom
</Button>

The override ladder is fully documented on the Theming page.

Do / Don't

  • Do name the action ("Save changes", not "OK"). Verbs > nouns.
  • Do pair destructive actions with color="danger" so the palette tells the same story as the label.
  • Don't use Button for navigation — wrap an <a> with asChild instead, so the element remains semantically a link.
  • Don't disable a button without telling the user why; pair disabled with a tooltip or helper text whenever feasible.