Components

Button

Text button in four contract variants (plus danger ghost) and three sizes (plus xl), with icons and a loading state.

Usage

Use it to:

  • trigger an action: save, create, confirm, open a menu
  • primary once per view for the main action; danger to confirm destructive actions

Don’t use it to:

  • navigate between pages (use Link, or Button asChild with a link when it must look like a button)
  • an icon without text (use IconButton)

Installation

Install the package (React 19):

terminal
npm install @krackedui/motion

Import the styles once, in your app entry or root layout:

/src/main.tsx
import '@krackedui/motion/styles.css';

Use it anywhere inside your app's <Theme> (see Installation):

/src/ButtonExample.tsx
import { Button } from '@krackedui/motion';

export function ButtonDemo() {
  return (
    <Button variant="primary">New page</Button>
  );
}

Examples

Variants

Size

With icon

Loading

The spinner replaces the content without changing the width; clicks are ignored and aria-busy is set.

Disabled

Full width

Use asChild to put the button styles on your own element, such as a link.

Dark theme

API Reference

Button

A <button>; supports all of its props. Adds:

PropTypeDefault
variant
"primary""secondary""ghost""danger""danger-ghost"
"ghost"
size
"sm""md""lg""xl"
"md"
icon
IconName
trailingIcon
IconName
loading
boolean
false
full
boolean
false
type
"button""submit""reset"
"button"
disabled
boolean
false
asChild
boolean
false

Accessibility

  • Tab focuses the button; Enter and Space activate it. The blue focus ring shows on keyboard focus.
  • Defaults to type="button", so it never submits a form by accident; pass type="submit" for the form’s main action.
  • loading keeps the accessible name, sets aria-busy and aria-disabled, and keeps focus on the button.
  • Icon-only actions need a name: use IconButton. On touch screens every button is at least 24×24.
© 2026 Motion. Internal documentation.