Toggle

Toggle: Two-state toggle button with pressed state animation. Free MIT React & Next.js source with Motion and Tailwind CSS, live preview, CLI install and docs.

Install Toggle

npx motion-ui-skill add toggle

Components install as source into your project. The interactive page also includes preview, code, documentation and install tabs.

Dependencies

  • @radix-ui/react-toggle
  • class-variance-authority
  • clsx
  • react
  • tailwind-merge

Source files

Toggle

Component from Motion UI: toggle

Install

npx motion-ui-skill add toggle

Dependencies

  • @radix-ui/react-toggle
  • class-variance-authority
  • clsx
  • react
  • tailwind-merge

Usage

"use client";

import Toggle from "@/components/craft/toggle";

export function Example() {
  return (
    <div className="p-6">
      <Toggle />
    </div>
  );
}

Browse this category