Skip to content

Saved Colors

Pro

Keep the colors a person uses again at the foot of a Color Picker. Add saves the current color, and the list can stay in local storage.

  • Base UI
  • React Aria
  • Motion
  • React 19
  • Tailwind CSS 4

Added Nov 9, 2026 · Pro license

Playground

Loading the preview

Props

Needs your Pro API key in GELATIN_UI_PRO_TOKEN. Set it up

Pro itemAPI key required

Saved Colors needs a Pro API key

Try the live preview for free. With Pro, the add command above puts the source in your project.

Files it adds
25
More Pro items, one API key
+327
Your coding agent runs it
1 cmd

$79$129once, for life

Already have Pro? Sign in to set up your API key.

In a ColorPicker, Add saves the picker color. Compose the label, Remove, the list, Add, and the empty words, and set storageKey to keep the list.

The sample also uses Color Picker. One command adds them with this item:

label-color.tsx

SavedColors

<div>
PropTypeDefaultDescription
size"default""lg""sm""default"The size of the swatches and of Add: sm 16, default 24, lg 32. A part prop wins.
rounded"default""full""full"The corner of the swatches and of Add: full (default, circles) or default.
colorsreadonly string[]—The saved colors (controlled), #RRGGBB or #RRGGBBAA.
defaultColorsreadonly string[]NO_COLORSThe saved colors at first (uncontrolled), and on the server with a storageKey.
onColorsChange—Runs when a color is saved or removed, with the new list.
maxnumber7The most colors the list keeps: SavedColorsAdd turns off at it. Default 7, one row of 24px swatches in a 248px popover.
storageKeystring—Keeps the uncontrolled list in localStorage under this key, and in every tab with the same key.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

SavedColorsList

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.
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>—
style—The inline style for the element. A function may be provided to compute the style based on component state.
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.
layout"grid""stack"'grid'Whether the items are arranged in a stack or grid.
classNamestring—
size"default""lg""sm"—The size of every swatch: sm 16, default 24, lg 32.
rounded"default""full"—The corner of every swatch and its ring: default (4, 6, 8px) or full (a circle).

SavedColorsAdd

<button>
PropTypeDefaultDescription
classNamestring—
size"default""lg""sm"—The size of Add. Default: the size of SavedColors, the size of its swatches.
rounded"default""full"—The corner of Add. Default: the rounded of SavedColors.
colorstring | Color—The color to save. Default: the color of the surrounding ColorPicker.
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

SavedColorsLabel

<span>
PropTypeDefaultDescription
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

SavedColorsEmpty

<span>
PropTypeDefaultDescription
...props<span> attributes—Every other attribute goes to the <span>, with a ref.
  • Use it in a ColorPicker popover, where Add saves the current color.
  • Use storageKey to keep the list in localStorage after a reload.
  • Use colors and onColorsChange when your app saves the list.
Arrow keysMoves to the next saved color and selects it.
DeleteorBackspaceRemoves the focused color and moves focus to the next one.
Add
indicator · 200ms · the new swatch grows from 0.5 and fades in
Remove
indicator · 200ms · the swatch fades out to 0.5, then the row closes up

Built with

Installs with Saved Colors

  1. AddedSaved Colors, with Button, Color Swatch, Color Swatch Picker.
Open the release