Skip to content

    Browse components

    Swatch Picker

    Color swatches where the selection ring glides from one to the next and a check pops in on the chosen color, picking a dark or light check to suit it. Arrow keys move the choice.

    Open
    Customize

    Installation

    npx shadcn@latest add @glint-ui/swatch-picker

    First time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/swatch-picker.json

    Usage

    import { SwatchPicker } from "@/components/ui/swatch-picker";
    
    <SwatchPicker
      colors={[{ name: "Lime", value: "#b5e61d" }, { name: "Sky", value: "#38bdf8" }]}
      value={color}
      onChange={setColor}
    />

    Props

    PropTypeDefaultDescription
    labelstring"Color"Group label.
    sizenumber32Swatch diameter in px.
    colorsReactNode—Array of { name, value } with hex values.
    valueReactNode—Controlled selection, pair with onChange.
    classNamestring—Extra classes for the root element.