Installation
Props
Button
Base UI button with the shadcn-style variant recipe, spring press feedback, optional intrinsic width animation, and Motion ripple layer.
variant"default" | "destructive" | "outline" | "secondary" | "ghost" | "link"Default default
linkUnderline"motion" | "static"Default "motion" (when variant is link)
size"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg"Default default
animateSizebooleanDefault false
disableRipplebooleanDefault false
type"button" | "submit" | "reset"Default button
childrenReactNodeiconReactNodeiconPosition"start" | "end"Default "start"
classNamestringdisabledbooleanStandard button attributes such as onClick, aria-*, name, form, and data-* are forwarded to the underlying motion.button.
The local pointer-down handler calls your onPointerDown first, then respects e.defaultPrevented before deciding whether to enter the pressed state or spawn a ripple.
Pointer, keyboard, and blur handlers keep the pressed state in sync so Space and Enter get the same immediate feedback as pointer input.
animateSize works best on intrinsically sized buttons rather than width-constrained layouts such as w-full.
When you render an icon-only button, add an aria-label so assistive tech still gets an accessible name.
buttonVariants
The CVA recipe exported alongside the component so matching button classes can be reused on links or custom wrappers.
variant"default" | "destructive" | "outline" | "secondary" | "ghost" | "link"Default "default"
size"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg"Default "default"
classNamestringVariants ship with six visual states and eight size tokens, including icon-only sizes.
Because buttonVariants is a plain CVA export, you can compose it independently from the Button component when you do not want a motion.button element.
Registry bundle
Install the exact registry entry shown on the right when you want the component file and its declared runtime dependencies together.
Dependencies: @base-ui/react, motion, class-variance-authority.
This page documents the Base UI install only, because Radix UI does not ship a separate button primitive.
The generated registry file is /r/b-button.json.