---
title: Toggle
tags: components,state,beginner
---
Renders a toggle component.
- Use the `useState()` hook to initialize the `isToggleOn` state variable to `defaultToggled`.
- Render an `` and bind its `onClick` event to update the `isToggledOn` state variable, applying the appropriate `className` to the wrapping `