ColorSwatch

ColorSwatch is a component that displays color samples.

Usage

import { ColorSwatch } from "@yamada-ui/react"
<ColorSwatch />

Change Variant

Change Size

Alpha

Example of color swatch using alpha channels.

Disable Shadow

By default, a shadow is included inline to make the color easier to see. To disable the shadow, set withShadow to false.

Group

To create color swatch containing multiple colors, use ColorSwatchGroup.

Props

Accessibility

If you set aria-label, it will be read by screen readers.

<ColorSwatch color="#4387f4" aria-label="Blue" />

ARIA Roles and Attributes

ComponentRoles and AttributesUsage
ColorSwatchrole="img"Indicates that this is an image.
aria-roledescription="color swatch"Sets to "color swatch".
aria-labelSets to the color value.
ColorSwatchGrouparia-label="color swatch group"Sets to "color swatch group".