humanonlyweb/ui

Button

A button, or a link styled as one.

Markdown

Examples

Variants

Copy code

Sizes

Copy code

Loading

Copy code

href renders an <a>; to renders your router's link.

Copy code

API

PropTypeDefault
variant

Style hook, exposed as data-button-variant.

"primary" | "secondary" | "solid" | "ghost" | "danger" | "link"—
size

Size hook, exposed as data-button-size.

"small" | "medium" | "large"—
fullWidth

Layout hook, exposed as data-button-full-width.

boolean—
loading

Busy state: blocks clicks and sets aria-busy, but stays focusable.

boolean—
disabled

Disables the button. A disabled link loses its href and leaves the tab order.

boolean—
type

Native button type.

"button" | "submit" | "reset"—
href

Renders an <a> to this URL instead of a <button>.

string—
to

Route for the router link given to createUi({ link }), rendering it instead of a <button>.

string | Record<string, unknown>—
target

Link target.

"_blank" | "_self" | "_parent" | "_top"—
SlotProps
default

Label.

—
leading

Before the label, e.g. an icon.

—
trailing

After the label, e.g. an icon.

—
spinner

Shown while loading.

—

Styling

Parts
buttonbutton-spinnerbutton-label
States
data-button-variantdata-button-sizedata-button-full-widthdata-button-disableddata-button-loading

Keyboard

KeysAction
Enter / SpaceActivate

Accessibility

  • While loading, clicks are ignored but the button keeps focus.
  • Disabled links lose their href and leave the tab order.