Button

A clear next step. Familiar actions, considered states, and the right amount of emphasis.

Variants

Choose an action to try its feedback.

Installation

Add editable source to an initialized React project. Set up antiflex/ui first if you are new here.

Terminal
npx antiflex-ui@0.1.0-alpha.2 add button

This site previews the latest workspace styles and motion. The published alpha keeps its released styles until the next npm release.

Usage

React
import { Button } from "./components/antiflex/button";

<Button onClick={createProject}>Create project</Button>

Sizes

Three heights, one rhythm. Use the same size for actions that belong together.

Sizes
32px
36px
40px

With icons

Keep a visible label when space allows. Name every icon-only action with aria-label.

With icons

Icons support the action. Labels carry its meaning.

Loading and disabled

Show progress where the action happened. Loading keeps the label visible and prevents repeat activation.

Loading and disabled

Try saving. The button prevents repeat activation.

Button group

Group related actions without merging their keyboard behavior.

Button group

Each native button keeps its own focus and pressed state.

Right-to-left

Logical spacing keeps the icon and its label together in either direction.

Right-to-left

Direction follows the surrounding document.

In context

Workspace settingsValidation, unsaved changes, and a complete save flow.

API reference

Button forwards native button attributes, className, and a ref. The default type is button; use type="submit" inside forms.

PropTypeDefault
variantprimary | secondary | ghost | dangerprimary
sizesm | md | lgmd
loadingbooleanfalse
disabledbooleanfalse

Accessibility

  • Use a native button for an action and a link for navigation.
  • Enter and Space activate the focused button. Keep the visible focus indicator.
  • Provide an accessible name for icon-only controls.
  • Loading sets aria-busy and native disabled state. Keep important outcomes visible outside the button.