Skip to main content

<ColorSwatch/>

A component includes a single color swatch

tip

Color swatches background color is bases on CSS, if you want to add new color add a new CSS file and use the fast-swatch-color-{color-name} prefix

swatches.css
.fast-swatch-color-blue{
background: blue;
}

.fast-swatch-color-very-blue-color{
background: blue;
}

We also support the legacy format used in our JS client, using the isp-product-color-swatch-${color_name} prefix

swatches.css
.isp-product-color-swatch-blue {
background: blue;
}

.isp-product-color-swatch-very_blue_color {
background: blue;
}

Props

OptionTypeDescription
colorstring (required)Color swatch color name
selectedboolean (default=false)is swatch selected
classNamestringCustom class for the swatch