Skip to content

Liquid Toggle

A soft switch with a liquid trail behind its moving thumb.

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 LiquidToggle from "./LiquidToggle";
export default function Example() {
return (
<LiquidToggle
defaultChecked={true}
label={"Stay curious"}
activeColor={"#c6b3df"}
inactiveColor={"#39313f"}
thumbColor={"#f7f0fc"}
disabled={false}
size={1.15}
/>
);
}

Using Liquid Toggle

Pair checked with onChange to store the switch value in your form state, or use defaultChecked for local state.

Give label a specific meaning such as enabling a preference. activeColor and inactiveColor customise the track in its two states.

Props

NameTypeRequiredDefaultDescription
checkedbooleanNoundefinedOptional controlled checked state.
defaultCheckedbooleanNofalseInitial checked state when uncontrolled.
onChangefunctionNoundefinedCalled with the new boolean checked state.
labelstringNo""Visible and accessible switch label.
activeColorstringNo"#c6b3df"Track colour when checked.
inactiveColorstringNo"#39313f"Track colour when unchecked.
thumbColorstringNo"#f7f0fc"Moving thumb and liquid trail colour.
disabledbooleanNofalseDisable native checkbox interaction.
sizenumberNo1Visual scale multiplier, clamped from 0.6 to 2.
classNamestringNo""Additional CSS classes, merged with the component styles.
styleCSSPropertiesNoundefinedInline styles for caller-defined sizing and visual overrides.

Related components

A recessed password field pairs a reveal control with an optional strength indicator.

Editable tags collect inside a softly framed input with individual remove controls.

A recessed search field expands into a polished capsule as you type.

Faceted stars lift into selection with a small marker beneath the chosen rating.