MCPcopy Create free account
hub / github.com/adobe/react-spectrum / ColorSwatch

Function ColorSwatch

starters/hooks/src/ColorSwatch.tsx:5–20  ·  view source on GitHub ↗
(props: AriaColorSwatchProps)

Source from the content-addressed store, hash-verified

3import './ColorSwatch.css';
4
5export function ColorSwatch(props: AriaColorSwatchProps) {
6 let {colorSwatchProps, color} = useColorSwatch(props);
7
8 return (
9 <div
10 {...colorSwatchProps}
11 className="react-aria-ColorSwatch"
12 style={{
13 ...colorSwatchProps.style,
14 // The color (and the checkerboard for transparency) comes from the resolved color.
15 background: `linear-gradient(${color}, ${color}),
16 repeating-conic-gradient(#CCC 0% 25%, white 0% 50%) 50% / 16px 16px`
17 }}
18 />
19 );
20}

Callers

nothing calls this directly

Calls 1

useColorSwatchFunction · 0.90

Tested by

no test coverage detected