Button Component โ€” Astro

Semantic button component with variants using theme variables

Button Component

Semantic button component with variants using theme variables.

Add this component

The command below includes <strong>Button</strong>โ€”run it in your project directory to install this component (and the CSS if needed). No prompts.

Choose your package manager โ€” click a tab to select, then copy the command.

npm pnpm yarn bun

Button variants

Live examples

Sizes:

All buttons use semantic theme variables, have hover and focus states, support disabled, and are keyboard accessible.

Usage

Usage

Full example for each framework (Astro, Vanilla, Svelte, Vue, React). Switch framework via View as or by clicking a Usage tabโ€”both stay in sync.

Astro Vanilla Svelte Vue React

Variants and sizes

  • btn โ€” Default
  • btn-primary โ€” Primary action
  • btn-secondary โ€” Secondary/muted action
  • btn-success, btn-warning, btn-error, btn-info โ€” Semantic states
  • btn-outline โ€” Outlined
  • btn-ghost โ€” Minimal, transparent until hover
  • btn--sm, btn--lg โ€” Size modifiers (combine with any variant)

Disabled State

Live Example

Other frameworks: Vanilla ยท Svelte ยท Vue ยท React