← All toggles
775

Simple Theme Toggle

Animated dark mode toggle component for React, Svelte, and Vue.

1Run the shadcn CLI
npx shadcn@latest add https://toggles.dev/r/simple
2Import and use
"use client";

import { useState } from "react";
import { Simple } from "@/components/ui/simple";

export default function App() {
  const [toggled, setToggled] = useState(false);

  return (
    <>
      {/* Alternatively, omit `toggled` when your app applies `dark` or `light`
          to a root element—the toggle follows that class automatically. */}
      <Simple
        toggled={toggled}
        onClick={() => setToggled((value) => !value)}
      />
    </>
  );
}