Button

Three buttons in one install: a Button that dips when pressed (with an opt-in Material ripple), a StatefulButton that rolls its label through loading, success and error, and a MagneticButton that drifts toward the pointer. Every size gets an invisible 44px hit area on touch screens.

Button

base.tsx

The everyday button: primary, secondary, ghost and outline styles in sm, md, lg and icon sizes, a spring dip on press, a slight grow on hover and an opt-in ripple from the press point. ButtonLink renders the same look as an anchor.

Button Button preview width

Install

$ bunx --bun shadcn add @karaui/button-base
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

Button

className?
string
—
variant?
"primary" | "secondary" | "ghost" | "outline"
primary
size?
"sm" | "md" | "lg" | "icon"
md
pressScale?
number
0.93
ripple?
boolean

Spawn a Material-style ripple from the press point. Off by default.

false

ButtonLink

className?
string
—
variant?
"primary" | "secondary" | "ghost" | "outline"
primary
size?
"sm" | "md" | "lg" | "icon"
md
pressScale?
number
0.93

Stateful Button

stateful.tsx

Set state to idle, loading, success or error and the label rolls over letter by letter, the icon slides in or out, and the button width eases to fit the new text. Copy for each state is a prop.

Button Stateful Button preview width

Install

$ bunx --bun shadcn add @karaui/button-stateful

API Reference

className?
string
—
variant?
"primary" | "secondary" | "ghost" | "outline"
—
size?
"sm" | "md" | "lg" | "icon"
—
pressScale?
number
—
ripple?
boolean

Spawn a Material-style ripple from the press point. Off by default.

—
icon?
ReactNode
—
state?
"idle" | "loading" | "success" | "error"
idle
loadingText?
ReactNode
Loading
successText?
ReactNode
Done
errorText?
ReactNode
Try again

Magnetic Button

magnetic.tsx

Button inside a Magnetic container, so it is tugged a little toward the cursor as it passes; strength (0.25 by default) sets the pull and the wrapper takes its own class.

Button Magnetic Button preview width

Install

$ bunx --bun shadcn add @karaui/button-magnetic

API Reference

className?
string
—
variant?
"primary" | "secondary" | "ghost" | "outline"
—
size?
"sm" | "md" | "lg" | "icon"
—
pressScale?
number
—
ripple?
boolean

Spawn a Material-style ripple from the press point. Off by default.

—
strength?
number

Magnetic pull strength. Default 0.25.

0.25
magneticClassName?
string

Class applied to the magnetic wrapper.

—

Updated