GitHubGitHub
← All components
Actions / component

Button

A polymorphic action with five visual variants, four sizes, loading, disabled, icon, link, and button states.

PrimaryLoadingDisabledDanger
<Button variant="primary">Save changes</Button>

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { Button } from '@chanrg/4ui';<Button variant="primary">Save changes</Button>

API reference

Props

PropTypeDefaultDescription
variantprimary | secondary | ghost | subtle | dangerprimaryVisual priority.
sizesm | md | lg | iconmdControl height and spacing. `icon` is square and text-free.
ariaLabelstringAccessible name. Required with size="icon", which shows no text.
hrefstringRenders an anchor when supplied.
loadingbooleanfalseShows progress and prevents activation.

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.

Accessibility

  • Loading sets aria-busy and disables repeated activation.
  • Links and buttons retain their native semantics.

Dependencies

SvelteKit resolve() for internal links