Chroma Panel

Search documentation

Find a page or section

A grid of swatches with roving focus.

Anatomy

import { SwatchGrid } from "chroma-panel";

Only inside a panel

This is one of the parts the built-in modes are made of. It reads the colour through usePanel(), so it only works inside a ChromaPanel — typically in a custom mode. For a picker outside the panel, use the store and hooks.

API reference

Props

PropTypeDefaultDescription
swatches*SwatchEntry[]The colours, each optionally with a name.
columnsnumber10Swatches per row. The pencil grid uses 30.
variantSwatchVariant'spaced''spaced' leaves gaps between swatches; the tighter variants butt them together, as the pencil grid does.
roundbooleanfalseRender every swatch as a circle.
label*stringAccessible name for the grid, such as the palette's name.
classNamestringClass on the grid.