Lucent UI
AvatarColorSwatchCodeBlock
✦ LLM-ready

ColorSwatch

atom

Standalone color swatch atom. Supports circle and square shapes, six sizes (xs–2xl), a selected state with an inset ring, and a checkerboard background for colors with transparency. Fully interactive as a button.

"Add a ColorSwatch from lucent-ui with a selected state and square shape. Use size="lg"."

Usage

React / JSX
import { ColorSwatch } from 'lucent-ui'

<ColorSwatch size="md" shape="circle" />

Installation

pnpm add lucent-ui

API Reference

ColorSwatch props — * required

PropTypeDefaultDescription
color*stringCSS color value to display.
size"xs" | "sm" | "md" | "lg" | "xl" | "2xl""md"Swatch diameter / side length.
shape"circle" | "square""circle"Swatch shape.
selectedbooleanfalseShows an inset ring to indicate selection.
showCheckerboardbooleanfalseShows a checkerboard pattern behind transparent colors.
onClick() => voidClick handler — makes the swatch interactive.