Skip to content

Color Swatch

Free

One color as a square or a circle in three sizes. A see-through color shows over a checkered ground, and a screen reader says its name.

  • React Aria
  • React 19
  • Tailwind CSS 4

Added Nov 9, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Pass a color. A string that is not a color throws, so check text from people first. Inside a color parent, it reads that color.

brand-swatch.tsx

ColorSwatch

PropTypeDefaultDescription
aria-labelstring—Defines a string value that labels the current element.
aria-labelledbystring—Identifies the element (or elements) that labels the current element.
aria-describedbystring—Identifies the element (or elements) that describes the object.
aria-detailsstring—Identifies the element (or elements) that provide a detailed, extended description for the object.
idstring—The element's unique identifier. See MDN.
dirstring—
langstring—
hiddenboolean—
inertboolean—
translate"no""yes"—
suppressHydrationWarningboolean—A React-only flag that suppresses the warning React normally logs when an element's server-rendered content doesn't match the client render during hydration. See React docs.
onClickMouseEventHandler<HTMLDivElement>—
onClickCaptureMouseEventHandler<HTMLDivElement>—
onAuxClickMouseEventHandler<HTMLDivElement>—
onAuxClickCaptureMouseEventHandler<HTMLDivElement>—
onContextMenuMouseEventHandler<HTMLDivElement>—
onContextMenuCaptureMouseEventHandler<HTMLDivElement>—
onDoubleClickMouseEventHandler<HTMLDivElement>—
onDoubleClickCaptureMouseEventHandler<HTMLDivElement>—
onMouseDownMouseEventHandler<HTMLDivElement>—
onMouseDownCaptureMouseEventHandler<HTMLDivElement>—
onMouseEnterMouseEventHandler<HTMLDivElement>—
onMouseLeaveMouseEventHandler<HTMLDivElement>—
onMouseMoveMouseEventHandler<HTMLDivElement>—
onMouseMoveCaptureMouseEventHandler<HTMLDivElement>—
onMouseOutMouseEventHandler<HTMLDivElement>—
onMouseOutCaptureMouseEventHandler<HTMLDivElement>—
onMouseOverMouseEventHandler<HTMLDivElement>—
onMouseOverCaptureMouseEventHandler<HTMLDivElement>—
onMouseUpMouseEventHandler<HTMLDivElement>—
onMouseUpCaptureMouseEventHandler<HTMLDivElement>—
onTouchCancelTouchEventHandler<HTMLDivElement>—
onTouchCancelCaptureTouchEventHandler<HTMLDivElement>—
onTouchEndTouchEventHandler<HTMLDivElement>—
onTouchEndCaptureTouchEventHandler<HTMLDivElement>—
onTouchMoveTouchEventHandler<HTMLDivElement>—
onTouchMoveCaptureTouchEventHandler<HTMLDivElement>—
onTouchStartTouchEventHandler<HTMLDivElement>—
onTouchStartCaptureTouchEventHandler<HTMLDivElement>—
onPointerDownPointerEventHandler<HTMLDivElement>—
onPointerDownCapturePointerEventHandler<HTMLDivElement>—
onPointerMovePointerEventHandler<HTMLDivElement>—
onPointerMoveCapturePointerEventHandler<HTMLDivElement>—
onPointerUpPointerEventHandler<HTMLDivElement>—
onPointerUpCapturePointerEventHandler<HTMLDivElement>—
onPointerCancelPointerEventHandler<HTMLDivElement>—
onPointerCancelCapturePointerEventHandler<HTMLDivElement>—
onPointerEnterPointerEventHandler<HTMLDivElement>—
onPointerLeavePointerEventHandler<HTMLDivElement>—
onPointerOverPointerEventHandler<HTMLDivElement>—
onPointerOverCapturePointerEventHandler<HTMLDivElement>—
onPointerOutPointerEventHandler<HTMLDivElement>—
onPointerOutCapturePointerEventHandler<HTMLDivElement>—
onGotPointerCapturePointerEventHandler<HTMLDivElement>—
onGotPointerCaptureCapturePointerEventHandler<HTMLDivElement>—
onLostPointerCapturePointerEventHandler<HTMLDivElement>—
onLostPointerCaptureCapturePointerEventHandler<HTMLDivElement>—
onScrollUIEventHandler<HTMLDivElement>—
onScrollCaptureUIEventHandler<HTMLDivElement>—
onWheelWheelEventHandler<HTMLDivElement>—
onWheelCaptureWheelEventHandler<HTMLDivElement>—
onAnimationStartAnimationEventHandler<HTMLDivElement>—
onAnimationStartCaptureAnimationEventHandler<HTMLDivElement>—
onAnimationEndAnimationEventHandler<HTMLDivElement>—
onAnimationEndCaptureAnimationEventHandler<HTMLDivElement>—
onAnimationIterationAnimationEventHandler<HTMLDivElement>—
onAnimationIterationCaptureAnimationEventHandler<HTMLDivElement>—
onTransitionCancelTransitionEventHandler<HTMLDivElement>—
onTransitionCancelCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionEndTransitionEventHandler<HTMLDivElement>—
onTransitionEndCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionRunTransitionEventHandler<HTMLDivElement>—
onTransitionRunCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionStartTransitionEventHandler<HTMLDivElement>—
onTransitionStartCaptureTransitionEventHandler<HTMLDivElement>—
slotstring | null—A 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.
render—Overrides 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.
colorstring | Color—The color value to display in the swatch.
colorNamestring—A 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).
rounded"default""full"—
size"default""lg""sm"—
classNamestring—
styleCSSProperties—Inline styles. An object only: the component sets the color in --color-swatch-color.
aria-hidden"false" | "true" | boolean—Hide the swatch from screen readers where the text next to it names the color. The component then renders a plain box: React Aria drops aria-hidden and always sets role="img" and a name.
  • Use it to show one color.
  • Use size sm, default, or lg, and rounded="full" for a circle.
  • Use it inside a ColorPicker with no color prop to show the picker color.
  • To let people change the color, use a Color Picker.
  • To show a status with a small mark, use a Dot.

React Aria names the color in the locale. colorName replaces it with a product name.

Set aria-hidden where the text next to it names the color. It then renders a plain box.

It takes no press. Put it inside a button to make it a control.

  1. AddedColor Swatch.
Open the release