ColorSample is a non-interactive color swatch. Use it next to a label so the meaning does not depend on color alone. Selection belongs to the surrounding control.
Usage
colorName selects a theme palette entry for the fill and border. variant accepts default or circle. Omitting it uses the default shape.
Custom colors
color overrides the fill; colorName remains required and still determines the border color. Native props, className, style, and ref target the swatch div. render accepts an element or callback through Base UI composition, for example a span inside text. Consumer styles override the default fill, border, or geometry. Decorative swatches use aria-hidden="true"; a standalone meaningful swatch uses role="img" with aria-label or aria-labelledby. To offer selectable colors, compose the swatch inside a labeled ListItem.
Migration
ColorSampleProps and ColorSampleVariant remain available from the data-display family. The unused pipeline variant is removed. Product-specific indicators belong in the application, using native styles or composition. Default and circle swatches keep their existing appearance.
Props
Mark decorative swatches as hidden from assistive technology.
string
Accessible name when the caller supplies role=“img”.
string
CSS class merged with the swatch class.
string
CSS color that overrides the background; the border still uses
colorName."amber" | "blue" | "bronze" | "brown" | "crimson" | "cyan" | "gold" | "grass" | "gray" | "green" | "iris" | "jade" | "lime" | "mint" | "orange" | "pink" | "plum" | "purple" | "red" | "ruby" | "sky" | "tomato" | "turquoise" | "violet" | "yellow"
required
Theme color used for the background and border. Required even when
color overrides the background.Ref<HTMLDivElement>
Ref to the swatch div, or the element supplied through render.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>
Element or render callback composed through Base UI useRender.
CSSProperties
Native styles merged with the swatch color defaults. Explicit styles win.
"circle" | "default"
Generic swatch shape:
default or circle. Omitting it uses the default shape.