Switch Field Input

Switch Field Input: Toggle switch with role=switch, keyboard support, hidden input for forms, and label/hint/error layout. Free MIT React & Next.js source with Motion and Tailwind CSS, live preview, CLI install and docs.

Install Switch Field Input

npx motion-ui-skill add switch-field-input

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

Dependencies

  • clsx
  • react
  • tailwind-merge

Source files

Switch Field Input

Toggle switch with role=switch, keyboard support, hidden input for forms, and label/hint/error layout.

Install

npx motion-ui-skill add switch-field-input

Dependencies

  • clsx
  • react
  • tailwind-merge

Usage

"use client";

import { SwitchFieldInput } from "@/components/inputs/switch-field-input";

export function SwitchFieldInputDemo() {
  return (
    <div className="flex items-center justify-center p-6">
      <SwitchFieldInput />
    </div>
  );
}

API Reference

SwitchFieldInput

Prop Type Default Required Description
className string — No Additional CSS classes

Browse this category