Clickable action/link control. Renders as an anchor (<a>) by default, or as a Next.js Link via the as prop.
Use Button for any primary action or navigation target. It is anchor-based, so it works both as a button (with onClick / type="submit") and as a link (with href).
IconButton instead — the isIconButton prop here is deprecated.ButtonGroup and ButtonList.There is no @uxf/form twin — Button is not a form field, it is a standalone control.
import { Button } from "@uxf/ui/button";
// action
<Button onClick={handleSave}>Save</Button>
// link (server-rendered anchor)
<Button href="/pricing">Pricing</Button>
// client-side navigation via Next.js Link
import Link from "next/link";
<Button as={Link} href="/dashboard">Dashboard</Button>
// form submit
<Button type="submit">Submit</Button>
Extends AnchorHTMLAttributes<HTMLAnchorElement> (minus type), so all standard <a> attributes (href, target, rel, download, onClick, className, children, …) are accepted.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | ButtonVariant | "default" | Visual style. |
color | ButtonColor | "default" | Color scheme. |
size | ButtonSize | "default" | Size. |
isFullWidth | boolean | false | Stretch to the full width of the container. |
isDisabled | boolean | false | Non-interactive state (sets aria-disabled, removes it from tab order). |
isLoading | boolean | false | Busy state (sets aria-busy, shows a spinner). |
type | "submit" | — | Submits the closest <form> on activation. This is the only accepted type. |
as | "a" | NextLink | "a" | Element to render. Pass Next.js Link for client-side navigation. |
analyticsCallback | () => void | — | Called when the button is activated (before onClick). |
isIconButton | boolean | false | Deprecated — use IconButton. |
Built-in values (from theme.ts):
| Group | Values |
|---|---|
variant | default, secondary, text |
size | sm, default, lg, xl |
color | default, positive, negative, warning, info, inverted |
These sets are open interfaces (ButtonVariants, ButtonSizes, ButtonColors). A project can add its own values via module augmentation:
// button.d.ts
declare module "@uxf/ui/button/theme" {
interface ButtonVariants {
cta: true;
}
}
Behavioural states:
Loading: set isLoading, or return a Promise from onClick — the button automatically enters the busy state until the promise settles.
<Button onClick={() => new Promise((resolve) => setTimeout(resolve, 1000))}>Save</Button>
Disabled: set isDisabled. Clicks and keyboard activation are blocked and the control leaves the tab order.
Links: when href and target="_blank" are set, rel="noopener noreferrer" is added automatically.
Import the component stylesheet once in your global CSS:
@import url("@uxf/ui/css/button.css");
Also requires the global @uxf/ui token layer, set up once per app — see @uxf/ui setup.