Keyframery

Animated Color Picker for UI SDK

The picker unfolds from its swatch, the thumb grows while you drag and the colour cross-fades.

Part of Keyframery, the open-source animated components for UI SDK

The demo plays by itself. Point at it or press Tab to take over.

Installation

npx shadcn@latest add @keyframery/color-picker

This adds components/keyframery/color-picker.tsx and its primitive, components/keyframery/primitives/color-picker.tsx, to your project, and installs @ui-sdk/react. The motion tokens are added to your global CSS the first time you install a component.

Usage

import {
  ColorPicker,
  ColorPickerArea,
  ColorPickerAreaCanvas,
  ColorPickerAreaThumb,
  ColorPickerChannelInput,
  ColorPickerContent,
  ColorPickerEyeDropper,
  ColorPickerInput,
  ColorPickerPopover,
  ColorPickerSlider,
  ColorPickerSliderThumb,
  ColorPickerSwatch,
  ColorPickerSwatches,
  ColorPickerSwatchItem,
  ColorPickerTrigger,
} from "@/components/keyframery/color-picker"

The parts and props are the same as UI SDK's Color Picker. For every prop, see the UI SDK color picker reference.

What moves

MoveWhat you see
UnfoldThe picker unfolds from its swatch.
PopA thumb grows while you hold it.
FadeThe chosen colour cross-fades everywhere it is used.

Timing and springiness follow the motion style you set, so this component moves like the rest of your app.

Swap the import

Already using UI SDK's color picker with your own styles? Keep your markup and change one line. The primitive adds motion and nothing else.

// Before
import { … } from "@ui-sdk/react/color-picker"

// After: same parts, same props, now animated
import { … } from "@/components/keyframery/primitives/color-picker"

Parts

The finished component exports 15 parts:

ColorPicker, ColorPickerArea, ColorPickerAreaCanvas, ColorPickerAreaThumb, ColorPickerChannelInput, ColorPickerContent, ColorPickerEyeDropper, ColorPickerInput, ColorPickerPopover, ColorPickerSlider, ColorPickerSliderThumb, ColorPickerSwatch, ColorPickerSwatches, ColorPickerSwatchItem, ColorPickerTrigger

Accessibility

Keyboard, focus and screen-reader behaviour come from UI SDK and are not changed. With reduced motion turned on, nothing in the color picker moves: changes happen at once or with a short fade. More in Accessibility.

Source

The code that lands in your project. It is yours to change.

Questions

How does the animated Color Picker for UI SDK move?

Unfold: The picker unfolds from its swatch. Pop: A thumb grows while you hold it. Fade: The chosen colour cross-fades everywhere it is used.

Do I need Motion or Framer Motion for the animated Color Picker?

No. Every move is plain CSS, so there is nothing to install besides the component and UI SDK.

Can I keep my own styling and only take the motion?

Yes. Import from @/components/keyframery/primitives/color-picker instead. It has the same parts and props as @ui-sdk/react/color-picker and adds motion only.

What happens to the Color Picker when someone turns on reduced motion?

Nothing moves. State changes happen at once, or with a short fade.

On this page