Skip to content
Lenso UI

ColorSwatch

A visible color sample, including alpha transparency.

Usage

import { ColorSwatch } from "@lenso/ui";
"use client";
import { ColorSwatch } from "@lenso/ui";import * as stylex from "@stylexjs/stylex";
const styles = stylex.create({ row: { display: "flex", alignItems: "center", gap: 12 } });export function ColorSwatchBasic() {  return (    <div {...stylex.props(styles.row)}>      <ColorSwatch aria-label="Blue" color="#0485F7" />      <ColorSwatch aria-label="Red" color="#EF4444" />      <ColorSwatch aria-label="Amber" color="#F59E0B" />      <ColorSwatch aria-label="Green" color="#10B981" />      <ColorSwatch aria-label="Fuchsia" color="#D946EF" />    </div>  );}

Examples

color swatch sizes

"use client";/** Adapted from HeroUI v3.2.6. Apache-2.0. */import { ColorSwatch } from "@lenso/ui";import * as stylex from "@stylexjs/stylex";import { styles } from "../color-picker/source.stylex";export function ColorSwatchSizes() {  return (    <div {...stylex.props(styles.row)}>      <ColorSwatch color="#0485F7" size="xs" />      <ColorSwatch color="#EF4444" size="sm" />      <ColorSwatch color="#F59E0B" size="md" />      <ColorSwatch color="#10B981" size="lg" />      <ColorSwatch color="#D946EF" size="xl" />    </div>  );}

color swatch shapes

"use client";/** Adapted from HeroUI v3.2.6. Apache-2.0. */import { ColorSwatch } from "@lenso/ui";import * as stylex from "@stylexjs/stylex";import { styles } from "../color-picker/source.stylex";export function ColorSwatchShapes() {  return (    <div {...stylex.props(styles.row)}>      <ColorSwatch color="#0485F7" shape="circle" />      <ColorSwatch color="#0485F7" shape="square" />    </div>  );}

color swatch transparency

"use client";/** Adapted from HeroUI v3.2.6. Apache-2.0. */import { ColorSwatch } from "@lenso/ui";import * as stylex from "@stylexjs/stylex";import { styles } from "../color-picker/source.stylex";export function ColorSwatchTransparency() {  return (    <div {...stylex.props(styles.row)}>      {[1, 0.75, 0.5, 0.25, 0].map((alpha) => (        <ColorSwatch          key={alpha}          aria-label={`${alpha * 100}% opacity`}          color={`rgba(4, 133, 247, ${alpha})`}        />      ))}    </div>  );}

color swatch render function

"use client";/** Adapted from HeroUI v3.2.6. Apache-2.0. Native RAC style render state replaces DOM render interception. */import { ColorSwatch } from "@lenso/ui";import * as stylex from "@stylexjs/stylex";import { styles } from "../color-picker/source.stylex";const colors = [  ["Blue", "#0485F7"],  ["Red", "#EF4444"],  ["Amber", "#F59E0B"],  ["Green", "#10B981"],  ["Fuchsia", "#D946EF"],] as const;export function RenderFunction() {  return (    <div {...stylex.props(styles.row)}>      {colors.map(([name, color]) => (        <ColorSwatch          key={name}          aria-label={name}          color={color}          data-custom={name.toLowerCase()}          style={({ color: c }) => ({ outlineColor: c.toString("css") })}        />      ))}    </div>  );}

color swatch accessibility

"use client";/** Adapted from HeroUI v3.2.6. Apache-2.0. */import { ColorSwatch } from "@lenso/ui";import * as stylex from "@stylexjs/stylex";import { styles } from "../color-picker/source.stylex";export function ColorSwatchAccessibility() {  return (    <div {...stylex.props(styles.row)}>      <ColorSwatch aria-label="Primary brand color" color="#0485F7" colorName="Ocean Blue" />      <ColorSwatch aria-label="Error state color" color="#EF4444" colorName="Coral Red" />      <ColorSwatch aria-label="Warning color" color="#F59E0B" colorName="Sunset Orange" />    </div>  );}

color swatch custom styles

"use client";/** Adapted from HeroUI v3.2.6. Apache-2.0. */import { ColorSwatch } from "@lenso/ui";import * as stylex from "@stylexjs/stylex";import { styles } from "../color-picker/source.stylex";const colors = ["#0485F7", "#EF4444", "#F59E0B", "#10B981", "#D946EF"];export function ColorSwatchCustomStyles() {  return (    <div {...stylex.props(styles.column8)}>      <div {...stylex.props(styles.column2)}>        <span {...stylex.props(styles.muted)}>Glow Effect</span>        <div {...stylex.props(styles.row4)}>          {colors.map((color) => (            <ColorSwatch              key={color}              color={color}              size="xl"              style={() => ({ boxShadow: `0 0 20px 2px ${color}` })}            />          ))}        </div>      </div>      <div {...stylex.props(styles.column2)}>        <span {...stylex.props(styles.muted)}>Gradient</span>        <div {...stylex.props(styles.row4)}>          {colors.map((color) => (            <ColorSwatch              key={color}              color={color}              size="xl"              style={({ color: c }) => ({                background: `linear-gradient(135deg, ${c.toString("css")}, white)`,              })}            />          ))}        </div>      </div>    </div>  );}

API Reference

Generated from the local public TypeScript exports. Types and callback state follow the installed native contracts, not the historical HeroUI API.

Only literal defaults in the component's parameter declaration are shown. Other defaults may depend on context or the native component.

ColorSwatchRoot

({ size, shape, xstyle, style, ...props }: ColorSwatchRootProps): JSX.Element

packages/react/src/components/color-swatch/color-swatch.tsx:13

react-aria-components/ColorSwatch

PropertyTypeRequiredLocal defaultDescription
colorstring | Color | undefinedNoNot declaredThe color value to display in the swatch.node_modules/react-aria/dist/types/src/color/useColorSwatch.d.ts:6
translateundefined | "yes" | "no"NoNot declarednode_modules/@react-types/shared/src/dom.d.ts:303
hiddenundefined | false | trueNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:301
styleStyleOrFunction<ColorSwatchRenderProps> | undefinedNoNot declaredThe inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. A function may be provided to compute the style based on component state.node_modules/react-aria-components/dist/types/src/utils.d.ts:132
slotstring | null | undefinedNoNot declaredA slot name for the component. Slots allow the component to receive props from a parent component. An explicit `null` value indicates that the local props completely override all props received from a parent.node_modules/react-aria-components/dist/types/src/utils.d.ts:172
dirstring | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:299
refRef<HTMLDivElement> | undefinedNoNot declaredAllows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).node_modules/@types/react/index.d.ts:301
idstring | undefinedNoNot declaredThe element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).node_modules/@react-types/shared/src/dom.d.ts:75
langstring | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:300
inertundefined | false | trueNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:302
aria-describedbystring | undefinedNoNot declaredIdentifies the element (or elements) that describes the object.node_modules/@react-types/shared/src/dom.d.ts:51
aria-detailsstring | undefinedNoNot declaredIdentifies the element (or elements) that provide a detailed, extended description for the object.node_modules/@react-types/shared/src/dom.d.ts:57
aria-labelstring | undefinedNoNot declaredDefines a string value that labels the current element.node_modules/@react-types/shared/src/dom.d.ts:41
aria-labelledbystring | undefinedNoNot declaredIdentifies the element (or elements) that labels the current element.node_modules/@react-types/shared/src/dom.d.ts:46
onAuxClickMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:322
onAuxClickCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:323
onClickMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:320
onClickCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:321
onContextMenuMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:324
onContextMenuCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:325
onDoubleClickMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:326
onDoubleClickCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:327
onMouseDownMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:328
onMouseDownCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:329
onMouseEnterMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:330
onMouseLeaveMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:331
onMouseMoveMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:332
onMouseMoveCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:333
onMouseOutMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:334
onMouseOutCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:335
onMouseOverMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:336
onMouseOverCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:337
onMouseUpMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:338
onMouseUpCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:339
onTouchCancelTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:342
onTouchCancelCaptureTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:343
onTouchEndTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:344
onTouchEndCaptureTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:345
onTouchMoveTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:346
onTouchMoveCaptureTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:347
onTouchStartTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:348
onTouchStartCaptureTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:349
onPointerDownPointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:352
onPointerDownCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:353
onPointerMovePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:354
onPointerMoveCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:355
onPointerUpPointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:356
onPointerUpCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:357
onPointerCancelPointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:358
onPointerCancelCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:359
onPointerEnterPointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:360
onPointerLeavePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:361
onPointerOverPointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:362
onPointerOverCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:363
onPointerOutPointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:364
onPointerOutCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:365
onGotPointerCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:366
onGotPointerCaptureCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:367
onLostPointerCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:368
onLostPointerCaptureCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:369
onScrollUIEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:372
onScrollCaptureUIEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:373
onWheelWheelEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:376
onWheelCaptureWheelEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:377
onAnimationStartAnimationEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:380
onAnimationStartCaptureAnimationEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:381
onAnimationEndAnimationEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:382
onAnimationEndCaptureAnimationEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:383
onAnimationIterationAnimationEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:384
onAnimationIterationCaptureAnimationEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:385
onTransitionCancelTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:388
onTransitionCancelCaptureTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:389
onTransitionEndTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:390
onTransitionEndCaptureTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:391
onTransitionRunTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:392
onTransitionRunCaptureTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:393
onTransitionStartTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:394
onTransitionStartCaptureTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:395
renderDOMRenderFunction<"div", ColorSwatchRenderProps> | undefinedNoNot declaredOverrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.node_modules/react-aria-components/dist/types/src/utils.d.ts:208
colorNamestring | undefinedNoNot declaredA localized accessible name for the color. By default, a description is generated from the color value, but this can be overridden if you have a more specific color name (e.g. Pantone colors).node_modules/react-aria/dist/types/src/color/useColorSwatch.d.ts:13
xstyleXStyleNoNot declaredpackages/react/src/utils/styled.tsx:7
data-slotunknownNoNot declaredpackages/react/src/utils/styled.tsx:8
sizeundefined | "xs" | "sm" | "md" | "lg" | "xl"No"md"packages/react/src/components/color-swatch/color-swatch.tsx:9
shapeundefined | "square" | "circle"No"circle"packages/react/src/components/color-swatch/color-swatch.tsx:10

Callback state: ColorSwatchRenderProps & { defaultStyle: CSSProperties; }

color
Color
defaultStyle
CSSProperties

Callback state: ColorSwatchRenderProps

color
Color

Native HTML and ARIA properties (1) โ€” Property set 1

ColorSwatch

({ size, shape, xstyle, style, ...props }: ColorSwatchRootProps): JSX.Element

packages/react/src/components/color-swatch/index.ts:8

ColorSwatch.Root

PropertyTypeRequiredLocal defaultDescription
colorstring | Color | undefinedNoNot declaredThe color value to display in the swatch.node_modules/react-aria/dist/types/src/color/useColorSwatch.d.ts:6
translateundefined | "yes" | "no"NoNot declarednode_modules/@react-types/shared/src/dom.d.ts:303
hiddenundefined | false | trueNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:301
styleStyleOrFunction<ColorSwatchRenderProps> | undefinedNoNot declaredThe inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. A function may be provided to compute the style based on component state.node_modules/react-aria-components/dist/types/src/utils.d.ts:132
slotstring | null | undefinedNoNot declaredA slot name for the component. Slots allow the component to receive props from a parent component. An explicit `null` value indicates that the local props completely override all props received from a parent.node_modules/react-aria-components/dist/types/src/utils.d.ts:172
dirstring | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:299
refRef<HTMLDivElement> | undefinedNoNot declaredAllows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).node_modules/@types/react/index.d.ts:301
idstring | undefinedNoNot declaredThe element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).node_modules/@react-types/shared/src/dom.d.ts:75
langstring | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:300
inertundefined | false | trueNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:302
aria-describedbystring | undefinedNoNot declaredIdentifies the element (or elements) that describes the object.node_modules/@react-types/shared/src/dom.d.ts:51
aria-detailsstring | undefinedNoNot declaredIdentifies the element (or elements) that provide a detailed, extended description for the object.node_modules/@react-types/shared/src/dom.d.ts:57
aria-labelstring | undefinedNoNot declaredDefines a string value that labels the current element.node_modules/@react-types/shared/src/dom.d.ts:41
aria-labelledbystring | undefinedNoNot declaredIdentifies the element (or elements) that labels the current element.node_modules/@react-types/shared/src/dom.d.ts:46
onAuxClickMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:322
onAuxClickCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:323
onClickMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:320
onClickCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:321
onContextMenuMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:324
onContextMenuCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:325
onDoubleClickMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:326
onDoubleClickCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:327
onMouseDownMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:328
onMouseDownCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:329
onMouseEnterMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:330
onMouseLeaveMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:331
onMouseMoveMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:332
onMouseMoveCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:333
onMouseOutMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:334
onMouseOutCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:335
onMouseOverMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:336
onMouseOverCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:337
onMouseUpMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:338
onMouseUpCaptureMouseEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:339
onTouchCancelTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:342
onTouchCancelCaptureTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:343
onTouchEndTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:344
onTouchEndCaptureTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:345
onTouchMoveTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:346
onTouchMoveCaptureTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:347
onTouchStartTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:348
onTouchStartCaptureTouchEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:349
onPointerDownPointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:352
onPointerDownCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:353
onPointerMovePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:354
onPointerMoveCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:355
onPointerUpPointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:356
onPointerUpCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:357
onPointerCancelPointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:358
onPointerCancelCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:359
onPointerEnterPointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:360
onPointerLeavePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:361
onPointerOverPointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:362
onPointerOverCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:363
onPointerOutPointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:364
onPointerOutCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:365
onGotPointerCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:366
onGotPointerCaptureCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:367
onLostPointerCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:368
onLostPointerCaptureCapturePointerEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:369
onScrollUIEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:372
onScrollCaptureUIEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:373
onWheelWheelEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:376
onWheelCaptureWheelEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:377
onAnimationStartAnimationEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:380
onAnimationStartCaptureAnimationEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:381
onAnimationEndAnimationEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:382
onAnimationEndCaptureAnimationEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:383
onAnimationIterationAnimationEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:384
onAnimationIterationCaptureAnimationEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:385
onTransitionCancelTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:388
onTransitionCancelCaptureTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:389
onTransitionEndTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:390
onTransitionEndCaptureTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:391
onTransitionRunTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:392
onTransitionRunCaptureTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:393
onTransitionStartTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:394
onTransitionStartCaptureTransitionEventHandler<HTMLDivElement> | undefinedNoNot declarednode_modules/@react-types/shared/src/dom.d.ts:395
renderDOMRenderFunction<"div", ColorSwatchRenderProps> | undefinedNoNot declaredOverrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.node_modules/react-aria-components/dist/types/src/utils.d.ts:208
colorNamestring | undefinedNoNot declaredA localized accessible name for the color. By default, a description is generated from the color value, but this can be overridden if you have a more specific color name (e.g. Pantone colors).node_modules/react-aria/dist/types/src/color/useColorSwatch.d.ts:13
xstyleXStyleNoNot declaredpackages/react/src/utils/styled.tsx:7
data-slotunknownNoNot declaredpackages/react/src/utils/styled.tsx:8
sizeundefined | "xs" | "sm" | "md" | "lg" | "xl"No"md"packages/react/src/components/color-swatch/color-swatch.tsx:9
shapeundefined | "square" | "circle"No"circle"packages/react/src/components/color-swatch/color-swatch.tsx:10

Callback state: ColorSwatchRenderProps & { defaultStyle: CSSProperties; }

color
Color
defaultStyle
CSSProperties

Callback state: ColorSwatchRenderProps

color
Color

Native HTML and ARIA properties (1) โ€” Property set 1

Shared native HTML and ARIA properties

Parts with identical inherited property records share one complete table. Different native types remain separate.

Property set 1 (1)

Applies to: ColorSwatchRoot, ColorSwatch

PropertyTypeRequiredLocal defaultDescription
keyKey | null | undefinedNoNot declarednode_modules/@types/react/index.d.ts:259

HeroUI v3.2.6 is the visual and historical reference, not an API compatibility promise. HeroUI v3.2.6