Cave design system
العربية

Components

Forms

Switch

An immediately applied on-or-off setting.

Preview

Open preview on its own

Code

Use native HTML and CSS; add JavaScript where interaction is needed.

import '@cave-ui/core/tokens.css';
import '@cave-ui/core/styles.css';
<label class="cave-control"><input class="cave-switch" type="checkbox" role="switch" name="notifications">Enable notifications</label>

Guidance

Use switches for settings that take effect immediately. Keep the label unchanged when toggled. Use role="switch" on a native checkbox and preserve its keyboard behaviour.