Components
Press Button
A 3D button that sinks when pressed.
<PressButton>
Play
</PressButton>Installation
npx shadcn@latest add https://ui.zjkm.tech/r/press-button.jsonimport { PressButton } from "@/components/press-button"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
A chunky 3D button with a darker base underneath. Pressing it sinks it into the base. It's pure CSS.
import { PressButton } from "@/components/press-button";
export function PlayButton() {
return <PressButton color="#15803d">Play</PressButton>;
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | The label. | |
color | string | "#15803d" | Face colour. The base is a darker shade. |
depth | number | 5 | Height of the base in pixels. |
...props | button props | Every native <button> prop: onClick, disabled, type and so on. |
With reduced motion, the press happens without a transition.