Checkbox

This is a Checkbox component.

Checkbox

Installation

1. Dependencies

npm install clsx tailwind-merge react-icons

2. Paste inside @/lib/utils.ts

import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: Parameters<typeof clsx>) {
  return twMerge(clsx(...inputs));
}

3. Copy Checkbox Code

Loading...

Copy Checkbox Code

Checkbox Props

NameTypeRequiredDefaultDescription
idstringYesundefinedThe unique identifier for the checkbox.
namestringYesundefinedThe name of the checkbox.
checkedbooleanYesfalseWhether the checkbox is checked or not.
onChange(event) => voidYesundefinedCallback function triggered when the checkbox state changes.
variant"circle" | "square"No"circle"The shape of the checkbox (circle or square).
activeIconReact.ReactNodeNoundefinedIcon to display when the checkbox is active.
inactiveIconReact.ReactNodeNoundefinedIcon to display when the checkbox is inactive.
activeColorstringNo"bg-green-500"Background color when the checkbox is active.
inactiveColorstringNo"bg-gray-300"Background color when the checkbox is inactive.
classNamestringNo"bg-gray-300"Additional class names for custom styling.