1. Components
  2. Colors
  3. Color Swatch

Color Swatch

A ColorSwatch displays a preview of a selected color.

<ColorSwatch color="#f00" />

Installation

npx dotui-cli@latest add color-swatch

Anatomy

import { ColorSwatch } from "@/components/core/color-swatch";
 
<ColorSwatch color="#f00" />;

Usage

Use a ColorSwatch to display a preview of a selected color.

API Reference

PropTypeDefaultDescription
color*string | Color-The color value to display in the swatch.
childrenReactNode | (values: ColorSwatchRenderProps & {defaultChildren: ReactNode | undefined}) => ReactNode-The children of the component. A function may be provided to alter the children based on component state.
classNamestring-The CSS className for the element.
styleCSSProperties | (values: ColorSwatchRenderProps & {defaultStyle: CSSProperties}) => CSSProperties-The inline style for the element. A function may be provided to compute the style based on component state.

Last updated on 10/11/2024

dotUI

Bringing singularity to the web.

Built by mehdibha. The source code is available on GitHub.