bx

Button

Displays a button or a component that looks like a button.

tsx
<Button>Default</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="outline">Outline</Button>

Button — le bouton shadcn universel. 6 variants (default, secondary, destructive, outline, ghost, link) × 4 sizes (default, sm, lg, icon). Peut rendre <button> ou <a> selon la présence de href.

Base des DropdownMenuTrigger, DialogTrigger, PopoverTrigger, AlertDialogAction… bref, la fondation de la moitié du kit.

Installation

Terminal
$ bext ui add button

Usage

tsx
import { Button } from "@bext-stack/ui/primitives"

<Button>Default</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="outline" size="sm">Small outline</Button>
<Button variant="destructive">Delete</Button>
<Button href="/docs" target="_blank">External link</Button>
<Button loading>Saving...</Button>

Anatomy

<Button variant="default|secondary|destructive|outline|ghost|link" size="default|sm|lg|icon" href?>
  ├── {loading ? <Spinner /> : icon && <Icon />}
  └── {children}

API Reference

Button

Prop Type Default Description
variant "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" "default" Style visuel du bouton.
size "default" | "sm" | "lg" | "icon" "default" Taille : sm=h-8, default=h-9, lg=h-10, icon=h-9 w-9 square.
href string Si présent, rend un au lieu de
target string Ex "_blank" pour ouvrir dans un nouveau tab.
type "button" | "submit" | "reset" "button" Type HTML pour les vrais boutons (dans un form).
icon string Slug lucide-like pour ajouter une icône à gauche du label.
loading boolean Affiche un spinner à la place de l'icône. Désactive le bouton (aria-busy).
disabled boolean Standard HTML.

Keyboard

Key Action
Enter / Space Active le bouton (comportement natif).
Tab Focus / défocus.

Accessibility

Toujours mettre un texte explicite ou un aria-label quand le bouton n'a qu'une icône (size="icon"). Sinon les AT annoncent "bouton" sans contexte.

loading=true ajoute aria-busy="true" et désactive le bouton.

Examples

Sizes (sm / default / lg / icon)

tsx
<Button size="sm">Small</Button>
<Button>Default</Button>
<Button size="lg">Large</Button>
<Button size="icon"><PlusIcon /></Button>

Loading state

tsx
<Button loading>Saving...</Button>
Try it live
Open in play

Edit this component live in the bext playground. The PRISM + signals version is the bext-native idiom — fine-grained reactivity, no virtual DOM.

src/app/page.tsx 2 files · signals · runs in your browser
Pure PRISM + real bext signals — fine-grained, no re-render.