Componentpickers0.69 KB gzipZero dependencies
Variant Picker
Color swatch and size variant picker with animated selection.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add variant-pickerOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { VariantPicker } from "@/components/ui/variant-picker"; <VariantPicker />Source code
variant-picker.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxvariant-picker.tsx84 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface ColorOption { name: string; className?: string;} export interface VariantPickerProps extends Omit<React.HTMLAttributes<HTMLElement>, "value" | "defaultValue"> { colors: ColorOption[]; sizes?: string[]; value?: string; defaultValue?: string; onColorChange?: (name: string) => void; onSizeChange?: (size: string) => void; className?: string;Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { VariantPicker } from "@/components/ui/variant-picker"; <VariantPicker />| Prop | Type | Description |
|---|---|---|
| colors | ColorOption[] | Configures colors. (Default: []) |
| sizes | string[] | Configures sizes. |
| value | string | Controlled value. |
| defaultValue | string | Initial value when uncontrolled. |
| onColorChange | (name: string) => void | Callback invoked on color change. |
| onSizeChange | (size: string) => void | Callback invoked on size change. |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |