Skip to content

Hold Button

Press and hold as a progress fill builds toward confirmation.

LIVE PREVIEWInteract with the component
Just React. No extra dependencies.

Copy the component and its CSS module into your project.

CSS Modules

Usage

Matches your current playground settings.

jsx
import HoldButton from "./HoldButton";
export default function Example() {
return (
<HoldButton
children={"Hold to confirm"}
completedLabel={"All done"}
holdDuration={1200}
resetAfter={2200}
accentColor={"#d8c3ee"}
background={"#292330"}
color={"#eee8f4"}
disabled={false}
/>
);
}

Using Hold Button

Use this button for an action where an intentional hold is useful. holdDuration defines the required time and onComplete performs the action.

Provide completedLabel to explain the result. Use disabled while your application cannot accept another action.

Props

NameTypeRequiredDefaultDescription
childrenReactNodeNoundefinedButton content before completion.
completedLabelReactNodeNo"Confirmed"Content displayed after the hold completes.
holdDurationnumberNo1200Required hold duration in milliseconds, with a minimum of 100.
onCompletefunctionNoundefinedCalled once after a full hold. Releasing early or leaving the button cancels.
resetAfternumberNo2000Milliseconds before allowing another hold. Zero keeps the completed state.
accentColorstringNo"#d8c3ee"Progress fill colour.
backgroundstringNo"#292330"Button background.
colorstringNo"#eee8f4"Button text colour.
disabledbooleanNofalseDisable holding. Space and Enter support keyboard activation.
classNamestringNo""Additional CSS classes, merged with the component styles.
styleCSSPropertiesNoundefinedInline styles for caller-defined sizing and visual overrides.

Related components

An action label contracts into a circular loader and resolves to a checkmark.

Alternating shutters close into a solid button face on hover or focus.

A raised rubber-stamp button leaves a fading outline when pressed.

A sculpted keycap compresses into its base with a satisfying press.