Clevision

Switch

Cards 1

About

Here is Switch component

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Switch to your project and fits it to your theme.

Code

How Switch is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { useId } from 'react'

import { DatabaseIcon } from 'lucide-react'

import { Label } from '@/components/ui/label'
import { Switch } from '@/components/ui/switch'

const SwitchCardDemo = () => {
  const id = useId()

  return (
    <div className='border-input has-data-[state=checked]:border-primary/50 relative flex w-full items-start gap-2 rounded-md border p-4 shadow-xs outline-none'>
      <Switch
        id={id}
        className='order-1 h-4 w-6 after:absolute after:inset-0 [&_span]:size-3 data-[state=checked]:[&_span]:translate-x-2.5 data-[state=checked]:[&_span]:rtl:-translate-x-2.5'
        aria-describedby={`${id}-description`}
      />
      <div className='flex grow items-center gap-3'>
        <DatabaseIcon />
        <div className='grid grow gap-2'>
          <Label htmlFor={id}>Backup</Label>
          <p id={`${id}-description`} className='text-muted-foreground text-xs'>
            Backup every file from your project.
          </p>
        </div>
      </div>
    </div>
  )
}

export default SwitchCardDemo

More by Clevision

View all
  • Portfolio Hero

    Portfolio Hero

    1.2K
  • Syntra Hero

    Syntra Hero

    776
  • Hero Section

    Hero Section

    454
  • Hardware Hero

    Hardware Hero

    257
  • Saas Hero Section

    Saas Hero Section

    245
  • Studio Hero

    Studio Hero

    245
  • Hero Section 41

    Hero Section 41

    210
  • Nexa Canvas Hero

    Nexa Canvas Hero

    123

More in Cards

View all
  • Course Design Cards

    Course Design Cards

    1.4K
  • Statistics Card 2

    Statistics Card 2

    322
  • Card

    Card

    19
  • Stats cards with links

    Stats cards with links

    46
  • Model Grid Cards

    Model Grid Cards

    6
  • Admin Dashboard Cards

    Admin Dashboard Cards

    46
  • Interactive Tech Stack Bento Grid with Hover Effects

    Interactive Tech Stack Bento Grid with Hover Effects

    781
  • Card

    Card

    2