A two-state button that can be either on or off.
import React from "react";import * as Toggle from "@radix-ui/react-toggle";import { FontItalicIcon } from "@radix-ui/react-icons";import "./styles.css";const ToggleDemo = () => (<Toggle.Root className="Toggle" aria-label="Toggle italic"><FontItalicIcon /></Toggle.Root>);export default ToggleDemo;
Full keyboard navigation.
Can be controlled or uncontrolled.
Install the component from your command line.
Import the component.
The toggle.