Toggle 04
A product-style feature flag toggle with setting-row hierarchy, descriptive metadata, and accessible state control.
Requirements
HTML, CSS, JavaScript
Dependencies
None
Usage
Copy index.html, styles.css and script.js into your project.
Typography: Inter, with a system sans-serif fallback.
About Toggle 04
Toggle 04 is a toggle component in the Toggle Components collection, available in HTML + CSS + JavaScript and React + TypeScript + Tailwind CSS. Last updated September 10, 2026.
- toggle
- feature flag toggle
What the code includes
HTML + CSS + JavaScript
3 files: index.html, styles.css, script.js
- Behavior is handled in script.js.
- ARIA in the markup: role switch; aria-checked, aria-labelledby.
- HTML elements used: button, svg.
- Includes a prefers-reduced-motion rule for its animation.
React + TypeScript + Tailwind CSS
3 files: Toggle04.jsx, Toggle04.types.ts, Toggle04.tailwind.css
- Configurable through 8 props: label, featureKey, badge, checked, defaultChecked, onCheckedChange, disabled, className.
- Uses React hooks: useId, useState.
- ARIA in the markup: role switch; aria-checked, aria-labelledby.
- HTML elements used: button, svg.