Color Swatch
A data display component that presents a solid color block for color previewing or selection.
Usage
Sizes
Use the color-swatch-{size} class to control the component size.
Size values can include:smmdlg.
For more information on all available sizing utilities, visit Tailwind
Variants
Use the variant and palette classes to control the appereance of the component.
Variant values can include solidoutlinesurfacesubtlelink.
Color palettes can include primaryneutral. For extra palettes such as warning error and more, refer to the Colors section.
Customizing
globals.css
:root {
--ex-color-swatch-size-sm: calc(var(--spacing) * 4);
--ex-color-swatch-size-md: calc(var(--spacing) * 5);
--ex-color-swatch-size-lg: calc(var(--spacing) * 6);
--ex-color-swatch-radius-sm: var(--radius-sm);
--ex-color-swatch-radius-md: var(--radius-sm);
--ex-color-swatch-radius-lg: var(--radius-sm);
}API
| Element | Selector |
|---|---|
ColorSwatch | .ex-color-swatch |
| Prop | Type | Default |
|---|---|---|
as | ElementType | div |
asChild | boolean | false |
Last updated on