Button
Hover decoration requires a fine pointer and hover support at widths of 768px or more. Phone and touch controls keep tap actions and keyboard focus without rollover effects.
Action buttons in six variants: guild (filled action), destructive (danger action), utility (text-only), primary (light gradient), secondary (dark gradient), outline (bordered container), OpenValueActive (selected filter) and hunter (role-specific surface), in S/M/L sizes, with loading, icon-only and disabled states. All colors come from tokens in @npolyhunter/ds/theme.css.
Playground
Live preview
Examples
Variants × Sizes
All variants
Filter trigger · outline and selected OpenValueActive
With icons
Left & right icons
leftIcon and rightIcon can be used together — the button keeps its gap on both sides. Icons are decorative here; the label carries the meaning.
import { Button, ArrowRightIcon } from "@npolyhunter/ui";
<Button rightIcon={<ArrowRightIcon />}>
Continue
</Button>
<Button
leftIcon={<ArrowRightIcon />}
rightIcon={<ArrowRightIcon />}
>
Both sides
</Button>Utility
Utility has no border or background at rest — text only. On hover it picks up the muted surface — no borders, no elevation.
Loading states
The spinner is the custom RefreshBoldDuotoneIcon icon spinning via animate-spin, fading in over 200ms. It inherits the button text color.
Disabled
Disabled renders flat: no shadows, borders, hover effects, or gradients, with disabled text color. Filled variants fall back to the surface-subtle background; utility stays transparent.
Motion Animated
Set motion to a preset name — micro, lift, press, bounce, tilt — or true for the default micro preset. Presets live in @npolyhunter/ui/lib/motion so any component can reuse them via motionPresetProps(). Individual whileHover, whileTap and transition props still override the preset. Powered by motion.
import { Button } from "@npolyhunter/ui";
// One prop, curated animation
<Button motion="micro">Micro</Button>
<Button motion="lift">Lift</Button>
<Button motion="press">Press</Button>
<Button motion="bounce">Bounce</Button>
<Button motion="tilt">Tilt</Button>
// Still customizable when needed
<Button motion="bounce" whileHover={{ scale: 1.1 }}>
Bounce, bigger hover
</Button>Motion Rolling Text
Wrap the label in RollingText inside a motion-enabled button — each character rolls up into a stacked duplicate, staggered left to right, triggered by the button's hover. Like motion.dev's rolling text button.
import { Button, RollingText } from "@npolyhunter/ui";
<Button motion>
<RollingText text="Hover me" />
</Button>Motion State Flow
The flow prop runs an async idle → pending → done sequence on click: the button awaits the onClick handler (return a promise for real async work), swaps label, icon and variant per phase, and blocks further clicks while pending. resetAfter auto-returns to idle after N ms; omit it to stay done until the next click restarts the flow, or set sticky: true to lock the button in the final state — no reset, further clicks ignored. Label/icon/variant are optional per phase — pending defaults to a spinner, done to a check.
import { Button } from "@npolyhunter/ui";
<Button
motion
flow={{
pending: { label: "Saving…" }, // original variant stays while saving
done: { label: "Saved", icon: <Check />, variant: "hunter" },
resetAfter: 2000,
}}
onClick={async () => {
await save(); // return a promise — the button awaits it
}}
>
<Save />
Save
</Button>
// Stay in the final state forever (clicks ignored afterwards)
<Button
motion
flow={{
pending: { label: "Subscribing…" },
done: { label: "Subscribed", icon: <Star />, variant: "hunter" },
sticky: true,
}}
onClick={subscribe}
>
Subscribe
</Button>Motion Confetti
Pass confetti to fire a confetti burst on click — or when a flow reaches its done state. true gives a sensible default burst; pass options to customize (any canvas-confetti option works). By default the burst erupts upward from the top of the button you clicked; pass origin to override. Loaded lazily, so it only downloads when a burst fires.
import { Button } from "@npolyhunter/ui";
// Burst on click
<Button motion confetti>
Celebrate
</Button>
// Combined with a flow — fires when done
<Button
motion
flow={{
pending: { label: "Completing…" },
done: { label: "Mission complete!" },
sticky: true,
}}
confetti={{ particleCount: 220, spread: 120, colors: ["#8b5cf6", "#22c55e"] }}
onClick={completeMission}
>
Complete mission
</Button>Hold to Confirm
Pass holdToConfirm to require a press-and-hold: a fill grows across the button and onClick fires only when it completes — releasing early drains the fill and cancels. true uses a 1.2s hold; pass { duration } to customize. Combines with motion presets, flow (hold completes → pending → done with its own label/icon/variant swap) and confetti. Regular clicks do nothing.
import { Button } from "@npolyhunter/ui";
// Hold ~1.2s to fire onClick
<Button variant="destructive" motion holdToConfirm onClick={deleteItem}>
Hold to delete
</Button>
// Custom hold time
<Button holdToConfirm={{ duration: 2000 }} onClick={deploy}>
Hold 2s to deploy
</Button>
// Hold to confirm → processing → confirmed (label, icon and variant swap)
<Button
variant="destructive"
motion="press"
holdToConfirm
flow={{
pending: { label: "Processing…" },
done: { label: "Confirmed", icon: <Check />, variant: "hunter" },
sticky: true, // stays confirmed — no hover, clicks ignored
}}
onClick={async () => {
await confirm(); // awaited while "Processing…" shows
}}
>
Hold to confirm
</Button>Code
import { Button } from "@npolyhunter/ui";
// Guild (filled) — the default action button
<Button variant="guild" size="medium">
Click me
</Button>
// Destructive — same as guild, red action background
<Button variant="destructive">
Delete
</Button>
// Utility (no border or background) — text only
<Button variant="utility" size="small">
Cancel
</Button>
// Primary — light gradient, dark text
<Button variant="primary" size="large">
Confirm
</Button>
// AI — product XP accent for generation actions
<Button variant="ai">Build with AI</Button>
// Secondary — dark gradient, light text
<Button variant="secondary" size="medium">
Continue
</Button>
// Outline — container surface with subtle border
<Button variant="outline">
Learn more
</Button>
// OpenValueActive — a selected filter with success border and brand text
<Button variant="openValueActive">Selected filter</Button>
// Hunter — role-specific surface with hunter accent text
<Button variant="hunter">
Take mission
</Button>
// Loading with the spinner on either side
<Button loading loadingPosition="right">
Saving
</Button>
// Icon-only (28×28 square) button
<Button iconOnly size="icon" aria-label="Search">
<Search />
</Button>Used in
Includes use through shared UI components.
