Press Scale

A utility class that dips an element while it is pressed.

Demo

Installation

press-scale comes with @kappa-ui/core/tailwind.css, which the components that draw with it import through the tokens item; there is no separate item.

Usage

It is a utility rather than a prop, so it composes with anything:

<Button class="press-scale">Press me</Button>

The element dips to --press-scale over --press-duration while held; on a component with a transition of its own, such as Button, the dip takes that transition's duration instead. On .is-mobile it switches to scale3d so the animation stays on the compositor, and honours --transform-extra if you are already applying a transform. Nothing here sets .is-mobile — that is your application's job. Under prefers-reduced-motion: reduce both the transition and the transform are dropped.

VariableDefaultDescription
--press-scale0.97Scale while pressed.
--press-duration120msDuration of the dip and the return.
--transform-extranoneA transform to keep applying under .is-mobile.