Base Button

A button with a subtle spring press, ripple, variants and sizes.

Preview

"use client";

import { ArrowRight, Download, Trash2 } from "lucide-react";
import { Button } from "@/components/motion/button";

export function ButtonBasePreview() {
  return (
    <div className="flex flex-col items-center gap-6">
      <div className="flex flex-wrap items-center justify-center gap-3">
        <Button sound variant="primary" size="md">
          Continue
          <ArrowRight className="h-4 w-4" />
        </Button>
        <Button sound variant="secondary" size="md">
          <Download className="h-4 w-4" />
          Download
        </Button>
        <Button sound variant="outline" size="md">Outline</Button>
        <Button sound variant="ghost" size="md">Ghost</Button>
      </div>
      <div className="flex flex-wrap items-center justify-center gap-3">
        <Button sound variant="primary" size="sm">Small</Button>
        <Button sound variant="primary" size="md">Medium</Button>
        <Button sound variant="primary" size="lg">Large</Button>
        <Button sound variant="secondary" size="icon" aria-label="Delete">
          <Trash2 className="h-4 w-4" />
        </Button>
      </div>
      <div className="flex flex-wrap items-center justify-center gap-3">
        <Button sound variant="primary" size="md" ripple>Ripple</Button>
        <Button sound variant="outline" size="md" ripple>Tap me</Button>
      </div>
    </div>
  );
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/button-base

API Reference

Button

className?
string

Classes merged onto the root element.

Default—
size?
"sm" | "md" | "lg" | "icon"

Height and padding; "icon" is a square icon-only button. Default: "md"

Defaultmd
variant?
"outline" | "ghost" | "primary" | "secondary"

Visual style: filled, card, ghost or outline. Default: "primary"

Defaultprimary
pressScale?
number

Scale while pressed. Default 0.97: subtle, so the press reads as feedback, not a squash.

Default0.97
ripple?
boolean

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

Defaultfalse
sound?
boolean

Play a soft press sound. Off by default; a `SoundProvider` can mute it app-wide.

Defaultfalse
className?
string

Classes merged onto the root element.

Default—
size?
"sm" | "md" | "lg" | "icon"

Height and padding; "icon" is a square icon-only link. Default: "md"

Defaultmd
variant?
"outline" | "ghost" | "primary" | "secondary"

Visual style: filled, card, ghost or outline. Default: "primary"

Defaultprimary
pressScale?
number

Scale while pressed. Default 0.97.

Default0.97
Also on React Native. Spring press, ripple, icons and a stateful variant.

More in Button

Updated