Fulldev UI

A color or pattern beside an option or filter value.

Color

Installation

npx shadcn@latest add @fulldev/swatch

Usage

import { Swatch } from "@/components/ui/swatch"
<Swatch color="#1e3a5f" />
<Swatch image="/swatches/denim.webp" />

color sets the background color and image the URL of a pattern or photo, such as a Shopify swatch. A swatch is decorative, so it renders with aria-hidden="true": keep the value’s name in text, or give the control around it an aria-label. A faint inner ring keeps white and black visible on any background. Set its size with a size-* class.

API Reference

PropTypeDefault
colorstringundefined
imagestringundefined

Source: src/components/ui/swatch