For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
/
150
Sponsor

Button

A button whose idle/hover/press/loading/success state is a pure function of the timeline.

Installation

$ pnpm dlx shadcn@latest add @framecn/button

Usage

import { Button } from "@/components/framecn/button";
<Button label="Continue" state="idle" />

Installing button also pulls in spinner via registry dependencies.

Smooth transitions

The docs preview animates hover → press → loading → success via useButtonTransition. Pass the resolved style to Button:

import { Button } from "@/components/framecn/button";
import { useButtonTransition } from "@/components/framecn/use-button-transition";
 
const style = useButtonTransition(
  [
    { at: 12, state: "hover" },
    { at: 30, state: "press" },
    { at: 48, state: "loading", duration: 6 },
    { at: 96, state: "success", duration: 16 },
  ],
  { variant: "default", primary: "#171717" }
);
 
<Button label="Continue" style={style} />;

Forward variant and primary into the hook when using style so the interpolated background tracks those props.

style takes precedence over state when both are provided.

Button heights follow the official shadcn baseline: 32px (sm), 36px (default), and 40px (lg). Theme colors and loading/success icons inherit the UI provider, including during transitions.

API Reference

Button

PropTypeDefault
state"idle" | "hover" | "press" | "loading" | "success""idle"
styleButtonStyle- (takes precedence over state)
labelstring"Continue"
variant"default" | "secondary" | "destructive" | "outline" | "ghost""default"
size"sm" | "default" | "lg""default"
themePartial<FramecnTheme>-
primarystring-
speednumber1
align"start" | "center" | "end""center"
classNamestring-