Skip to content

Petal Toggle

A sculptural flower unfurls its petals as the switch turns on.

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 PetalToggle from "./PetalToggle";
export default function Example() {
return (
<PetalToggle
defaultChecked={true}
label={"Enable bloom"}
color={"#deb78c"}
inactiveColor={"#847a92"}
size={110}
disabled={false}
/>
);
}

Using Petal Toggle

Give label a specific meaning for the setting controlled by the flower. The component exposes its state as an accessible switch.

Use checked with onCheckedChange for external state, or defaultChecked for local state. size controls the flower while preserving a minimum button target.

Props

NameTypeRequiredDefaultDescription
checkedbooleanNoundefinedOptional controlled switch state.
defaultCheckedbooleanNofalseInitial uncontrolled switch state.
onCheckedChangefunctionNoundefinedCalled with the new boolean switch state.
labelstringNo"Toggle"Accessible switch label.
disabledbooleanNofalseDisable the native button.
colorstringNo"#deb78c"Open petal colour.
inactiveColorstringNo"#847a92"Closed petal colour.
sizenumberNo80Flower size in pixels, with a minimum target of 44.
classNamestringNo""Additional classes for the root element.
styleCSSPropertiesNoundefinedInline styles for caller-defined size, typography, and appearance.

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.