Skip to content

ColorGrid ​

ColorGrid is a grid of preset colors, of which one can be chosen.

When to use ​

Use it for a small set of named colors, alone or at the top of a ColorPicker. Each color needs a name, which is what a screen reader says; label names the group.

Props ​

PropDefaultDescription
colorsrequired{ hex, name }[]
valueThe chosen color, compared without regard to case
onselectrequiredCalled with the hex of the pressed color
labelrequiredThe name of the group
columns9The number of columns

Contract ​

The colors stand in columns gap-2xs apart and fill the width of the container; each cell is a square of the color itself, with a line inside, and nothing is placed in it. The chosen cell shows a ring inside, two lines of the focus color and one of the surface. The group is a radiogroup and each cell a radio.

Example ​

ColorGrid

Released under the Apache-2.0 license.