Button
The Button is an action element with color, variant and size options, plus
disabled, loading and block states. It's written once as a .uf.tsx
component and compiled to all seven frameworks.
Here it is in the framework you picked in the Framework select:
import { IButton } from "@inkline/react";
export function Actions() {
return <IButton label="Save" color="primary" />;
}
Pick another in the Framework select to compare them.
Variants
The Button has six style variants, set with variant, and nine colours, set with
color:
<IButton label="Solid" variant="solid" />
<IButton label="Outline" variant="outline" />
<IButton label="Soft" variant="soft" />
<IButton label="Subtle" variant="subtle" />
<IButton label="Ghost" variant="ghost" />
<IButton label="Link" variant="link" />
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Button text content. |
color | primary | secondary | success | info | warning | error | light | dark | neutral | neutral | Color variant. |
variant | solid | outline | soft | subtle | ghost | link | solid | Style variant. |
size | xs | sm | md | lg | xl | md | Size variant. |
type | button | submit | reset | button | Native button type. |
disabled | boolean | false | Disables the button. |
loading | boolean | false | Shows a loading spinner. |
block | boolean | false | Renders a full-width button. |
id | string | — | The native button's id. |
ariaLabel | string | — | The native button's aria-label. |
ariaDescribedby | string | — | The native button's aria-describedby. |
Events
| Event | Payload | Fires |
|---|---|---|
click | none | When the native button is clicked. |
Listen with onClick in React and Solid, @click in Vue, onclick in Svelte,
onClick$ in Qwik and (ufClick) in Angular. Astro renders on the server, so
nothing listens there. click carries no event object: to call
preventDefault() or read the modifier keys, listen to click on an element
around the button, where the native event still bubbles.
Composition
IButton is a styled wrapper around a headless base, IButtonBase, which
carries the behavior and none of the styling. Import the base from
@inkline/<framework>/headless when you want the button's mechanics under your
own CSS — see
Your first component.