Skip to Content
NarakUI

Button

Trigger an action or event, such as submitting a form or displaying a dialog.

Sizes

The default size is regular.

Variants

The default mode is secondary.

Toggle state

Pair subtle and tertiary for a view switcher. subtle is the off state: transparent background and secondary text, changing to a tertiary background and primary text on hover. tertiary is the selected state: tertiary background and primary text, with no hover change. Both modes use a quaternary background while pressed. Set aria-pressed to expose which view is selected.

Start and end icons

iconStart and iconEnd take an icon name, or { name, variant } for an icon variant. Pass a custom node only for artwork outside the icon set. A button with an icon and no label is an icon-only button, so give it an aria-label.

Loading

Loading disables the button, which switches it to the secondary background, so these examples sit on a card like they do in the product. Text-only buttons keep the centered spinner overlay so the control does not reflow. Use a fixed width such as w-40 when you want to lock the size during that transition.

Loading interactive

See the loading state transition as the button enters and exits loading.

Loading variants

Compare loading states across the primary, secondary, ghost, destructive, and dashed modes.

Loading sizes

Compare the loading overlay at each supported button size.

Loading fixed width

A fixed width keeps the button size consistent while its loading overlay is visible.

Loading icon toggle

When the button has an icon, the spinner replaces that icon and the label stays visible.

Loading with icons

The spinner replaces the start icon when one exists, the end icon when that is the only icon, and only the start icon when both are present. Icon-only buttons swap the icon for the spinner. ghost and subtle use a tertiary background while loading.

Installation

pnpm dlx shadcn@latest add @narakui/button

Add "@narakui": "https://ui.narakcode.dev/r/{name}.json" to components.json, or install directly from https://ui.narakcode.dev/r/button.json.

Usage

import { Button } from '@/components/ui/button';

<Button>Click me</Button>

Properties

PropTypeDefaultDescription
mode'primary' | 'secondary' | 'tertiary' | 'ghost' | 'subtle' | 'destructive' | 'dashed''secondary'Visual style of the button
secondarySurface'control' | 'page''control'Use 'page' to give a secondary button the page background when it sits on a tinted surface
size'micro' | 'small' | 'regular' | 'large''regular'Size of the button on desktop
iconStartButtonIconValue—Icon name or { name, variant } shown at the start of the button. Pass a node only for artwork that isn't in the icon set
iconEndButtonIconValue—Icon shown at the end of the button. Same values as iconStart
loading{ isLoading?: boolean; className?: string }—Loading state configuration. Disables the control while loading. Text-only buttons show a centered spinner overlay. When an icon is present the spinner replaces that icon and the label stays visible.
contentClassNamestring—Custom class name for the button content wrapper
allowScaleOnClickbooleantrueShrinks the button while it is pressed. A button that opens a popup (aria-haspopup, such as a menu or popover trigger) stays still unless this is set
errorbooleanfalseWhether to display the button in error state
classNamestring—Additional CSS classes to apply to the button
childrenReactNode—Button content
disabledbooleanfalseWhether the button is disabled
type'button' | 'submit' | 'reset''button'Button type attribute
hrefstring—Renders a Next.js Link instead of a button. While disabled or loading it renders a non-interactive span with aria-disabled
prefetchLinkProps['prefetch']—Next.js Link prefetch behavior. Only applies with href