Clevision

Switch

Cards 2

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 { 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'>
        <img
          src='https://cdn.21st.dev/assets/mirror/ca/ca0ac8f80b56f39878f7c694fd5dda149c5fad368a9a5f975aa654be79a10a23.png'
          alt='GitHub Icon'
          className='size-5'
        />
        <div className='grid grow gap-2'>
          <Label htmlFor={id}>Connect with GitHub</Label>
          <p id={`${id}-description`} className='text-muted-foreground text-xs'>
            Access your projects direct from GitHub.
          </p>
        </div>
      </div>
    </div>
  )
}

export default SwitchCardDemo

More by Clevision

View all
  • Portfolio Hero

    Portfolio Hero

    796
  • Syntra Hero

    Syntra Hero

    579
  • Hero Section

    Hero Section

    305
  • Hero Section 41

    Hero Section 41

    173
  • Studio Hero

    Studio Hero

    155
  • Hardware Hero

    Hardware Hero

    152
  • Saas Hero Section

    Saas Hero Section

    151
  • Calendar

    Calendar

    116

More in Cards

View all
  • Course Design Cards

    Course Design Cards

    1.3K
  • Card Studio

    Card Studio

    37
  • Approval Card

    Approval Card

    37
  • Card

    Card

    64
  • Stats cards with links

    Stats cards with links

    102
  • Feature UI Row

    Feature UI Row

    35
  • Statistics Card 2

    Statistics Card 2

    314
  • Statistics Card 10

    Statistics Card 10

    305