Skip to Content
zjkm-ui
Components

Press Button

A 3D button that sinks when pressed.

Props
5px
<PressButton>
  Play
</PressButton>

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/press-button.json
import { 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

PropTypeDefaultDescription
childrenReactNodeThe label.
colorstring"#15803d"Face colour. The base is a darker shade.
depthnumber5Height of the base in pixels.
...propsbutton propsEvery native <button> prop: onClick, disabled, type and so on.

With reduced motion, the press happens without a transition.

On this page