View as Markdown

API reference: @salmonui/inputs/color-picker

ColorSwatchcomponent

import { ColorSwatch } from '@salmonui/inputs/color-picker';
function ColorSwatch(props: ColorSwatchProps): ReactNode;

A color preview: role="img" named by the color, the color over a checkerboard so alpha shows, or a struck-through box for no color. Pure markup, server rendered.

Props: ColorSwatchProps

ColorSwatch props (6)
NameSignatureDescription
colorreadonly color: ColorInput | null;

The color; null draws the "no color" swatch.

aria-labeloptionalreadonly 'aria-label'?: string | undefined;

Accessible name; default the color's description ('dark vibrant green') or 'No color'. Pass '' to make it decorative.

colorNameoptionalreadonly colorName?: ((color: Color) => string) | undefined;

Replaces the English description when no aria-label is given.

idoptionalreadonly id?: string | undefined;
classNameoptionalreadonly className?: string | undefined;
styleoptionalreadonly style?: CSSProperties | undefined;