UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

shadcn/ui/Checkbox

Inputs & forms
1 of 3
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

3 versions·3 librariesCompare all checkboxes →

  • shadcn/ui
  • 8bitcn
  • HextaUI

Checkbox

npx shadcn@latest add https://ui.shadcn.com/r/styles/new-york-v4/checkbox.json
Open in v0 Docs Repo
Library
shadcn/ui
License
MIT
Stack
React · Tailwind CSS · radix
Packages
cnradix-ui
Also adds
label
Size
32 lines
Demo
From shadcn/ui

Code

registry/new-york-v4/ui/checkbox.tsx

"use client"

import * as React from "react"
import { cn } from "cn"
import { CheckIcon } from "lucide-react"
import { Checkbox as CheckboxPrimitive } from "radix-ui"

function Checkbox({
  className,
  ...props
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
  return (
    <CheckboxPrimitive.Root
      data-slot="checkbox"
      className={cn(
        "peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary",
        className
      )}
      {...props}
    >
      <CheckboxPrimitive.Indicator
        data-slot="checkbox-indicator"
        className="grid place-content-center text-current transition-none"
      >
        <CheckIcon className="size-3.5" />
      </CheckboxPrimitive.Indicator>
    </CheckboxPrimitive.Root>
  )
}

export { Checkbox }

More like this

Ai Instructions

Cult UI·Buttons

Magic Card

Magic UI·Cards

Checkbox

HextaUI·Inputs & forms

Border Beam

Magic UI·Backgrounds

Item

shadcn/ui·Other

Radio group

HextaUI·Inputs & forms

Ripple Button

Magic UI·Backgrounds

Texture Card

Cult UI·Text effects

Label

HextaUI·Inputs & forms

Item

HextaUI·Text effects

Shine Border

Magic UI·Cursor & effects

Carousel

HextaUI·Media & 3D

Signature Pad

Kokonut UI·Inputs & forms

Card

shadcn/ui·Cards

Textarea

shadcn/ui·Text effects