humanonlyweb/ui

Icon Button

A button with only an icon.

Markdown

Examples

Basic

Copy code

API

PropTypeDefault
variant

Style hook, exposed as data-button-variant.

"primary" | "secondary" | "solid" | "ghost" | "danger" | "link""ghost"
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"—
label*

Accessible name; icon-only buttons have no visible text to supply one.

string—
shape

Shape hook, exposed as data-button-shape.

"round" | "square"—
SlotProps
default

The icon.

—
spinner

Shown while loading, in place of the icon.

—

Styling

Parts
States
data-button-shapedata-button-icon-only

Accessibility

  • label is required: with no visible text, it's the button's only name.