Press
Buttons, primary actions. Sinks under your foot, springs back off it.
- Sport
- Football
- Move
- Sinks under your foot, springs back off it.
- For
- Buttons, primary actions
down 120ms · release 560ms spring · reduced: colour only
01 Install
npx shadcn@latest add https://moveui-red.vercel.app/r/press.jsonIt brings the tokens with it. The first time, import the tokens once in your root layout:
import "@/components/moveui/tokens.css";Not using shadcn? Copy the files below into components/moveui/, and tokens.css next to them.
02 Use it
import { Press } from "@/components/moveui/press/press";
export function Save() {
return <Press onClick={() => save()}>Save</Press>;
}03 Or ask your agent
Paste this into Claude Code, Cursor or any coding agent. It installs the piece and wires it in.
Add the Move UI "Press" piece to this project. It's for: Buttons, primary actions.
1. Install it: npx shadcn@latest add https://moveui-red.vercel.app/r/press.json
2. If the project doesn't import the Move UI tokens yet, add this once to the root layout: import "@/components/moveui/tokens.css";
3. Use it like this, adapted to where it belongs in my code:
import { Press } from "@/components/moveui/press/press";
export function Save() {
return <Press onClick={() => save()}>Save</Press>;
}
Keep its reduced-motion behaviour and keyboard support. Don't hardcode durations, easing or colours: they come from the --ml-* tokens.
Docs: https://moveui-red.vercel.app/pieces/pressWant your agent to know the whole library and its motion rules? Add the Move UI skill to your project:
npx shadcn@latest add https://moveui-red.vercel.app/r/skill.json04 Code
"use client";
import { forwardRef, type ButtonHTMLAttributes, type KeyboardEvent } from "react";
import "./press.css";
/**
* Press: a button with weight. Sinks on press, springs back on release.
* CSS does the motion. The only JS: Enter gets the same press feel that Space gets natively.
*/
export const Press = forwardRef<HTMLButtonElement, ButtonHTMLAttributes<HTMLButtonElement>>(
function Press({ className, onKeyDown, onKeyUp, onBlur, ...props }, ref) {
const release = (el: HTMLElement) => el.removeAttribute("data-pressed");
return (
<button
ref={ref}
className={["ml-press", className].filter(Boolean).join(" ")}
onKeyDown={(e: KeyboardEvent<HTMLButtonElement>) => {
if (e.key === "Enter" && !e.repeat) e.currentTarget.setAttribute("data-pressed", "");
onKeyDown?.(e);
}}
onKeyUp={(e) => {
if (e.key === "Enter") release(e.currentTarget);
onKeyUp?.(e);
}}
onBlur={(e) => {
release(e.currentTarget);
onBlur?.(e);
}}
{...props}
/>
);
},
);
/*
Press: a button with weight.
Down: sinks to 96% in --ml-dur-tap, like a foot on the ball.
Release: springs back with one small overshoot (--ml-ease-settle over --ml-dur-travel).
Hover: turns to chrome (--ml-chrome), a sheen crosses once. Pressed: darker chrome.
Reduced motion: no scale, only the colour change.
Transform only, so no layout shift.
*/
.ml-press {
--_scale: 1;
appearance: none;
border: 0;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 0.5em;
padding: 1.05em 2em;
border-radius: var(--ml-radius-control);
background: var(--ml-ink);
color: var(--ml-ink-fg);
font-family: inherit;
font-weight: 500;
font-size: 0.8125rem;
line-height: 1;
letter-spacing: var(--ml-tracking);
text-transform: uppercase;
transform: scale(var(--_scale));
transition:
transform var(--ml-dur-travel) var(--ml-ease-settle),
color var(--ml-dur-quick) var(--ml-ease-out);
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
user-select: none;
}
.ml-press:active,
.ml-press[data-pressed] {
--_scale: 0.96;
color: var(--ml-chrome-fg);
transition:
transform var(--ml-dur-tap) var(--ml-ease-out),
color var(--ml-dur-tap) var(--ml-ease-out);
}
/* Chrome on hover: the metal fades in under the label, a sheen crosses it once. */
.ml-press { position: relative; isolation: isolate; }
.ml-press::before {
content: "";
position: absolute;
inset: 0;
z-index: -1;
border-radius: inherit;
background: var(--ml-chrome-sheen), var(--ml-chrome);
background-size: 260% 100%, 100% 100%, 100% 100%; /* sheen, then the two chrome layers */
background-position: 115% 0, 0 0, 0 0;
box-shadow: var(--ml-chrome-edge);
opacity: 0;
transition: opacity var(--ml-dur-quick) var(--ml-ease-out), background-position 0s linear var(--ml-dur-quick);
}
.ml-press:hover { color: var(--ml-chrome-fg); }
.ml-press:hover::before {
opacity: 1;
background-position: -15% 0, 0 0, 0 0;
transition: opacity var(--ml-dur-quick) var(--ml-ease-out), background-position var(--ml-dur-flight) var(--ml-ease-out);
}
.ml-press:active::before { opacity: 1; background: var(--ml-chrome-press); }
.ml-press[data-pressed]::before { opacity: 1; background: var(--ml-chrome-press); }
.ml-press:focus-visible {
outline: 2px solid var(--ml-focus);
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
.ml-press:active,
.ml-press[data-pressed] {
--_scale: 1;
}
}
