[ Actions ]
Button
Buttons trigger an action: submitting a form, opening a dialog, saving changes. Reusify buttons come in sixteen variants grouped by emphasis, six semantic colors (or any CSS color), three sizes and a free radius. They support icons, icon-only and pill shapes, a loading state, links via href, and grouping with ButtonGroup.
Import#
import { Button, ButtonGroup } from 'reusify-ui';When to use#
- Pick the variant by emphasis first: one high-emphasis button (solid, brand or gradient) per area, medium for its partners, low for everything else.
- Use color only to add meaning: danger for destructive actions, success for confirmations. Keep most buttons primary.
- Use gradient for a single marketing or hero call to action, not for every button in a form.
- Use text and link variants for quiet actions next to a CTA, such as "Learn more".
- Navigating to another page? Pass href so the button renders a real <a>.
- Destructive actions (delete, revoke) should use color="danger", ideally behind a confirmation Modal.
Examples#
[ Overview ]
Variants are grouped by emphasis. Start here to pick the right one, then use the color prop when the action has a meaning such as danger.
Choosing a variant#
| Emphasis | Variant | Preview | Use it for |
|---|---|---|---|
| High | solid | The main action of a screen or form: Save, Create, Continue. | |
| High | normal | A plain, flat button with no border, shadow or press effect: Download, Continue. | |
| High | gradient | One hero or marketing call to action per page, in any semantic color. | |
| High | glossy | A bright, top-lit sign-up or purchase button in any color: Sign up, Buy now. | |
| High | pixel | A playful, glossy feature action with a mosaic texture: Copy build notes, Launch. | |
| Medium | raised | Tactile pill buttons in menus and action lists: Copy design.md, Add to moodboard. | |
| Medium | framed | A standout link card-like button with an outer frame: Visit site, Open in app. | |
| Medium | secondary | The partner of a primary action: Cancel, Back, Export. | |
| Medium | soft | Colored but calm actions inside cards and lists: Add tag, Retry. | |
| Medium | outline | Alternative choices next to a solid button: Compare plans. | |
| Medium | subtle | Neutral, low-noise controls on busy surfaces: Show hint, Filter. | |
| Low | ghost | Toolbars, icon buttons and table-row actions. | |
| Low | text | Quiet secondary links next to a CTA: Learn more, Browse docs. | |
| Low | link | An action that reads like inline text inside a sentence. | |
| Low | dashed | Empty slots and "add" actions: Add workspace, New column. |
// Emphasis decides the variant…
<Button variant="solid">Save</Button> // high
<Button variant="gradient">Get started</Button> // high, marketing
<Button variant="secondary">Cancel</Button> // medium
<Button variant="text">Learn more</Button> // low
// …and color adds meaning.
<Button variant="solid" color="danger">Delete</Button>[ Styles ]
Every variant, from loudest to quietest. All of them follow your theme tokens and dark mode.
High emphasis: solid & gradient#
solid is the default: a filled button with a subtle top sheen and a hairline ring. gradient is the same fill in any semantic color, with a soft colored glow.
<Button>Save changes</Button>
<Button variant="gradient" rightIcon={<FiArrowRight />}>Get started</Button>Gradient in any color#
gradient uses the same diagonal three-stop fill and edge as brand, but follows the color prop (or --ru-primary), so it fits any semantic color. Pair it with text buttons for the secondary choices.
{/* Semantic color */}
<Button variant="gradient" size="lg" color="success" rightIcon={<FiArrowRight />}>
Start your first lab
</Button>
<Button variant="text" size="lg">Try it below</Button>
<Button variant="text" size="lg">Browse labs</Button>
{/* Your own brand color */}
<div style={{ '--ru-primary': '#0f6a54' }}>
<Button variant="gradient" size="lg" rightIcon={<FiArrowRight />}>Start your first lab</Button>
</div>Medium emphasis: secondary, soft, outline & subtle#
secondary is a quiet surface button with a ring. soft is a tinted fill in the button color. outline is a colored border. subtle is a neutral, barely-there tint with a hairline border that fits busy surfaces.
<Button variant="secondary">Cancel</Button>
<Button variant="soft">Add tag</Button>
<Button variant="outline">Compare plans</Button>
<Button variant="subtle">Show hint</Button>Low emphasis: ghost, text & link#
ghost shows colored text with a hover tint, ideal for toolbars. text is muted neutral text that darkens on hover. link reads like an inline link.
Already have an account?
<Button variant="ghost" leftIcon={<FiEdit2 />}>Edit</Button>
<Button variant="text">Learn more</Button>
<p>Already have an account? <Button variant="link">Sign in</Button></p>Colors#
color works with solid, gradient, soft, outline, ghost and link. Colors come from theme tokens, so they follow your brand and dark mode. (secondary, subtle and text are intentionally neutral.)
<Button color="primary">Primary</Button>
<Button color="success">Success</Button>
<Button color="danger">Danger</Button>
<Button variant="soft" color="warning">Warning</Button>
<Button variant="outline" color="info">Info</Button>
<Button variant="gradient" color="danger">Danger</Button>[ Tactile styles ]
Three richer surfaces for menus, launch moments and link-style actions. They pair well with justify="between": label on the left, icon on the far right.
Framed, pixel & raised#
A typical action menu: a framed link at the top, one pixel button for the main action, and raised pills for the rest.
Pixel#
A glossy pill with a faint mosaic texture, a darker edge and a soft glow in its own color. On hover, brighter pixels light up around the cursor and follow it across the button (try it). It follows the color prop, so it works in any color, semantic or custom.
<Button variant="pixel" rightIcon={<FiTerminal />}>Copy build notes</Button>
<Button variant="pixel" color="success">Deploy</Button>
<Button variant="pixel" color="#7c3aed">Generate</Button>
<Button variant="pixel" color="#f97316" textColor="#1c1917">Launch</Button>Raised#
A neutral pill with a soft vertical gradient, a hairline border and a thin line under its bottom edge. No inner shadow; on hover the face dulls slightly toward gray, and like every button it shrinks a little when pressed. It adapts to dark mode automatically.
<Button variant="raised" rightIcon={<FaMarkdown />}>Copy design.md</Button>
<Button variant="raised" leftIcon={<FiLayers />}>Add to moodboard</Button>
<Button variant="raised" radius="lg">Not a pill</Button>Framed#
A flat face inside a thin, soft outer frame. The frame is drawn with a shadow, so leave about 6px of space around it. On keyboard focus the frame takes the button color.
<Button variant="framed" leftIcon={<FiZap color="#a855f7" />} rightIcon={<FiArrowUpRight />}>
Visit Pikaicons
</Button>
<Button variant="framed" href="https://github.com/dopemukesh" leftIcon={<FaGithub />}>GitHub</Button>
<Button variant="framed" radius="full">Framed pill</Button>Normal#
A flat fill and nothing else: no border, shadow, sheen or press scale. It is neutral by default (dark in light mode, light in dark mode), and color sets any fill. color="muted" is its quiet partner: soft gray with a hairline border.
<Button variant="normal" size="lg" pill fullWidth>Download for x64</Button>
<Button variant="normal" size="lg" pill>Get started</Button>
<Button variant="normal" color="muted" size="lg" pill>Book a demo</Button>
<Button variant="normal" color="primary">Primary</Button>
<Button variant="normal" color="#0ea5e9" radius="full">Any color</Button>Key#
A chunky 3D keycap: the face sits on a darker edge and travels down when pressed. Set aria-pressed to keep it down, which makes it a good toggle.
<Button variant="key" aria-pressed>Pressed</Button>
<Button variant="key" color="#2a2a2e" textColor="#a1a1aa">Dark key</Button>
<Button variant="key" color="success">Confirm</Button>
<Button variant="key" color="#f59e0b" iconOnly aria-label="Star"><FiStar /></Button>Glossy & dashed#
glossy is a bright, top-lit gradient with a darker rim and a soft glow, in any color. dashed marks an empty slot or an "add" action and stays neutral until hovered.
<Button variant="glossy" size="lg" radius="xl">Sign up</Button>
<Button variant="glossy" color="success">Publish</Button>
<Button variant="glossy" color="#e11d48">Go live</Button>
<Button variant="dashed" iconOnly size="lg" radius="xl" aria-label="Add workspace"><FiPlus /></Button>
<Button variant="dashed" leftIcon={<FiPlus />}>Add item</Button>In an app header#
A raised icon tile with a tooltip, a dashed "add" slot, a raised "Latest" button, and a glossy Sign up, all with radius="xl".
Light & dark#
Every tactile style is built from theme tokens, so it adapts on its own. Here both themes are pinned with className="light" and className="dark".
light
dark
<div className="light">…</div>
<div className="dark">…</div>[ Full control ]
Every button takes any color, any text color, any corner radius and a content alignment, on top of the variant. Try them all in the playground.
Button playground#
<Button
variant="pixel"
size="lg"
color="#5b4cf5"
justify="between"
style={{ width: 300 }}
rightIcon={<FiTerminal />}
>
Copy build notes
</Button>// Pick a variant, size, radius and colors in the preview.
// The code next to the button updates as you go.Any color#
color accepts the six semantic names, or any CSS color: hex, rgb(), hsl(), oklch() or a CSS variable. Hover shades, borders, rings and glows are all derived from it.
<Button color="#0ea5e9">Sky</Button>
<Button variant="soft" color="rgb(217 70 239)">Fuchsia</Button>
<Button variant="outline" color="hsl(160 84% 39%)">Emerald</Button>
<Button variant="gradient" color="oklch(0.65 0.2 40)">Sunset</Button>
<Button variant="pixel" color="var(--my-brand)">My brand</Button>Text color#
Light custom colors need dark text. textColor sets the label and icon color for every state.
<Button color="#facc15" textColor="#1c1917">Yellow</Button>
<Button variant="pixel" color="#a3e635" textColor="#1a2e05">Lime</Button>
<Button variant="raised" textColor="#5b4cf5">Brand label</Button>Radius#
radius takes a preset (none, sm, md, lg, xl, 2xl, full), a number of pixels, or any CSS length. It overrides the variant and size defaults.
<Button radius="none">None</Button>
<Button radius="sm">sm</Button>
<Button radius="lg">lg</Button>
<Button radius="2xl">2xl</Button>
<Button radius="full">full</Button>
<Button radius={3}>3px</Button>
<Button variant="raised" radius="0.5rem">0.5rem</Button>Content alignment#
justify="start" aligns content to the left; justify="between" keeps the label on the left and pushes the right icon to the far edge. Use them on wide or full-width buttons.
<Button fullWidth variant="secondary" justify="start" leftIcon={<FiSettings />}>Settings</Button>
<Button fullWidth variant="secondary" justify="between" rightIcon={<FiArrowRight />}>Continue</Button>
<Button fullWidth variant="secondary">Centered (default)</Button>[ Sizes & shape ]
Sizes#
Three heights: sm (32px), md (40px, the default) and lg (48px). Corners grow with the size (8px, 10px, 14px by default, all derived from --ru-radius). Keep sizes consistent within a group.
<Button size="sm">Small</Button>
<Button size="md">Medium</Button>
<Button size="lg">Large</Button>Pill#
pill makes the button fully rounded. Works with every variant and size.
<Button pill>Subscribe</Button>
<Button pill variant="soft" leftIcon={<FiPlus />}>Follow</Button>
<Button pill variant="gradient" size="lg">Join the waitlist</Button>Icon buttons#
iconOnly makes a square button for a single icon. Always add an aria-label, and wrap it in a Tooltip so mouse users see the label too.
<Tooltip content="Edit">
<Button iconOnly variant="ghost" aria-label="Edit"><FiEdit2 /></Button>
</Tooltip>
<Button iconOnly variant="subtle" aria-label="Settings"><FiSettings /></Button>
<Button iconOnly variant="soft" color="danger" aria-label="Delete"><FiTrash2 /></Button>
<Button iconOnly pill aria-label="Add"><FiPlus /></Button>Full width#
fullWidth stretches the button to its container. Useful for mobile layouts and narrow forms.
<div style={{ width: 320 }}>
<Button fullWidth>Sign in</Button>
<Button fullWidth variant="secondary" leftIcon={<FaGithub />}>Continue with GitHub</Button>
</div>[ Content & state ]
With icons#
Pass any element to leftIcon or rightIcon. Icons are sized to 1em, so they scale with the button. These examples use react-icons, but any SVG works.
import { FiPlus, FiArrowRight, FiDownload } from 'react-icons/fi';
<Button leftIcon={<FiPlus />}>New project</Button>
<Button variant="secondary" rightIcon={<FiArrowRight />}>Continue</Button>
<Button variant="outline" leftIcon={<FiDownload />}>Download</Button>Loading state#
Set loading while an async action runs. The button shows a spinner, is disabled to prevent double submits, and sets aria-busy. Click to try it.
Disabled#
Disabled buttons are dimmed and ignore clicks. Explain nearby why an action is unavailable.
<Button disabled>Solid</Button>
<Button variant="gradient" disabled>Gradient</Button>
<Button variant="secondary" disabled>Secondary</Button>
<Button color="danger" leftIcon={<FiTrash2 />} disabled>Delete</Button>[ Composition ]
Button groups#
ButtonGroup spaces related buttons evenly. Add attached to join them into one segmented control; combine with aria-pressed for toggle groups. Give the group an aria-label.
Buttons as links#
Pass href to render a real <a> with button styling, so it works with middle-click and "open in new tab". Other anchor props (target, rel, download) pass through. For client-side routing, wrap a router Link around the text instead, or use your router's navigate in onClick.
<Button href="/docs" rightIcon={<FiArrowRight />}>Read the docs</Button>
<Button href="https://github.com/dopemukesh" target="_blank" rel="noreferrer"
variant="secondary" leftIcon={<FaGithub />}>
GitHub
</Button>
<Button href="/report.pdf" download variant="outline" leftIcon={<FiDownload />}>Download report</Button>Form submit#
Buttons default to type="button", so they never submit a form by accident. Set type="submit" explicitly on the submit button.
<form onSubmit={handleSubmit}>
{/* fields… */}
<Button variant="secondary" type="reset">Reset</Button>
<Button type="submit">Create account</Button>
</form>[ Real-world patterns ]
Copy-ready combinations for the places buttons appear most.
Hero call to action#
One gradient button for the main action, quiet text buttons for the alternatives.
Learn database design by modeling it.
Design the schema behind real apps on a canvas. Every step is checked as you build.
<h1>Learn database design by modeling it.</h1>
<p>Design the schema behind real apps on a canvas.</p>
<div>
<Button variant="gradient" size="lg" rightIcon={<FiArrowRight />}>Start your first lab</Button>
<Button variant="text" size="lg">Try it below</Button>
<Button variant="text" size="lg">Browse labs</Button>
</div>Dialog footer#
Cancel on the left as secondary, the confirming action on the right. Use color="danger" when it destroys data.
Delete project?
This permanently deletes Project Alpha. This can't be undone.
<Modal
open={open}
onClose={close}
title="Delete project?"
footer={
<>
<Button variant="secondary" onClick={close}>Cancel</Button>
<Button color="danger" leftIcon={<FiTrash2 />} onClick={remove}>Delete project</Button>
</>
}
/>Empty state#
A solid button for the first step and a soft or text button for help.
No messages yet
When people reach out, their messages show up here.
<FiInbox />
<h3>No messages yet</h3>
<p>When people reach out, their messages show up here.</p>
<Button leftIcon={<FiPlus />}>New message</Button>
<Button variant="soft" leftIcon={<FiShare2 />}>Share your link</Button>Used in designs#
Button in real layouts: these 37 designs use it. Open one to try it and copy the code.
- Get started checklistTasks & workflow
- Activity feedTasks & workflow
- Transaction stepsTasks & workflow
- Members ProjectsDashboard widgets
- Start ProjectDashboard widgets
- Upcoming meetingDashboard widgets
- PerformanceDashboard widgets
- Total projectDashboard widgets
- Employee spotlightDashboard widgets
- Flight trackerDashboard widgets
- Pattern sign-upAuthentication
- Sign inAuthentication
- Forgot passwordAuthentication
- Reset passwordAuthentication
- Verify emailAuthentication
- Upgrade to ProPricing & billing
- Monthly budgetPricing & billing
- Pricing planPricing & billing
- Plan usagePricing & billing
- NotificationsSettings & profile
- Profile cardSettings & profile
- Feature inviteAnnouncements & modals
- Pro welcomeAnnouncements & modals
- Order cardsE-commerce
- Challenge inviteSocial & fitness
- Mood check-inSocial & fitness
- Who to followSocial & fitness
- Follow cardSocial & fitness
- Streak widgetSocial & fitness
- Contact cardSocial & fitness
- Event detailsProductivity
- File uploadProductivity
- Sign the contractProductivity
- Upload statusProductivity
- BlockersProductivity
- Run timelineProductivity
- Job cardsProductivity
API reference#
<Button />
Also accepts every native <button> attribute (onClick, name, form, aria-*, …), or <a> attributes when href is set. Forwards its ref to the rendered element.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'solid' | 'normal' | 'gradient' | 'glossy' | 'pixel' | 'secondary' | 'soft' | 'outline' | 'subtle' | 'raised' | 'framed' | 'key' | 'ghost' | 'text' | 'link' | 'dashed' | 'solid' | Visual style, by emphasis. 2.0's 'primary', 'danger' and 'success' still work (solid + that color). |
color | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | CSS color | 'primary' | A semantic name or any CSS color (hex, rgb, hsl, oklch, var()). Drives fill, hover, border, ring and glow of colored variants; the focus ring of neutral ones. |
textColor | CSS color | - | Label and icon color for every state. Use it with light custom colors. |
radius | 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full' | number | CSS length | - | Corner radius (0, 6, 10, 14, 18, 24px, pill). Numbers are pixels. Overrides variant and size defaults. |
justify | 'center' | 'start' | 'between' | 'center' | Content alignment. 'between' keeps the label left and pushes rightIcon to the far edge. |
size | 'sm' | 'md' | 'lg' | 'md' | Height, padding, font size and default radius. |
leftIcon | ReactNode | - | Element rendered before the label. Hidden while loading. |
rightIcon | ReactNode | - | Element rendered after the label. Hidden while loading. |
iconOnly | boolean | false | Square button for a single icon child. Needs an aria-label. |
pill | boolean | false | Fully rounded corners. |
fullWidth | boolean | false | Stretches to the width of the container. |
loading | boolean | false | Shows a spinner, disables the button and sets aria-busy. |
disabled | boolean | false | Disables interaction (aria-disabled on links). |
href | string | - | Renders an <a> styled as a button instead of a <button>. |
type | 'button' | 'submit' | 'reset' | 'button' | Native button type (ignored with href). |
className | string | - | Extra classes merged onto the element. |
variant'solid''solid' | 'normal' | 'gradient' | 'glossy' | 'pixel' | 'secondary' | 'soft' | 'outline' | 'subtle' | 'raised' | 'framed' | 'key' | 'ghost' | 'text' | 'link' | 'dashed'Visual style, by emphasis. 2.0's 'primary', 'danger' and 'success' still work (solid + that color).
color'primary''primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | CSS colorA semantic name or any CSS color (hex, rgb, hsl, oklch, var()). Drives fill, hover, border, ring and glow of colored variants; the focus ring of neutral ones.
textColor-CSS colorLabel and icon color for every state. Use it with light custom colors.
radius-'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full' | number | CSS lengthCorner radius (0, 6, 10, 14, 18, 24px, pill). Numbers are pixels. Overrides variant and size defaults.
justify'center''center' | 'start' | 'between'Content alignment. 'between' keeps the label left and pushes rightIcon to the far edge.
size'md''sm' | 'md' | 'lg'Height, padding, font size and default radius.
leftIcon-ReactNodeElement rendered before the label. Hidden while loading.
rightIcon-ReactNodeElement rendered after the label. Hidden while loading.
iconOnlyfalsebooleanSquare button for a single icon child. Needs an aria-label.
pillfalsebooleanFully rounded corners.
fullWidthfalsebooleanStretches to the width of the container.
loadingfalsebooleanShows a spinner, disables the button and sets aria-busy.
disabledfalsebooleanDisables interaction (aria-disabled on links).
href-stringRenders an <a> styled as a button instead of a <button>.
type'button''button' | 'submit' | 'reset'Native button type (ignored with href).
className-stringExtra classes merged onto the element.
<ButtonGroup />
Renders a <div role="group"> and accepts every <div> attribute. Put Buttons directly inside it.
| Prop | Type | Default | Description |
|---|---|---|---|
attached | boolean | false | Joins the buttons into one segmented control (shared edges, no gap). |
aria-label | string | - | Describes the group for screen readers, e.g. "Text alignment". |
children | ReactNode | - | Button elements. |
attachedfalsebooleanJoins the buttons into one segmented control (shared edges, no gap).
aria-label-stringDescribes the group for screen readers, e.g. "Text alignment".
children-ReactNodeButton elements.
Accessibility#
- Renders a native <button> (or <a> with href), so it is focusable and works with Enter and Space out of the box.
- A visible focus ring appears on keyboard focus only (:focus-visible), in the button color.
- Icon-only buttons must have an aria-label, for example <Button iconOnly aria-label="Delete"><FiTrash2 /></Button>.
- Use aria-pressed on buttons that toggle (segmented controls, formatting toolbars).
- While loading, aria-busy="true" tells assistive technology the action is in progress.
- Disabled links get aria-disabled and lose their href, so they cannot be followed.
- ButtonGroup uses role="group"; give it an aria-label that names the set.