Skip to content

feat(components): add ColorPicker component#10685

Draft
aviralj02 wants to merge 2 commits into
shadcn-ui:mainfrom
aviralj02:feature/color-picker
Draft

feat(components): add ColorPicker component#10685
aviralj02 wants to merge 2 commits into
shadcn-ui:mainfrom
aviralj02:feature/color-picker

Conversation

@aviralj02
Copy link
Copy Markdown

Summary

Adds a new ColorPicker component built on top of react-color-strip — a lightweight, accessible color strip primitive I authored and
maintain. I thought it might be a good fit for shadcn since there isn't a first-party color picker in the registry yet.

Happy to adjust anything that doesn't match the project's conventions — this is my first contribution here and I may have missed something.

What's included

  • Component (registry/new-york-v4/ui/color-picker.tsx) — a hue strip with an optional shade strip (showShade prop), supports controlled and uncontrolled usage, auto-sizes via
    ResizeObserver so it works in any container width
  • Registry entries_registry.ts for both the UI component and the example, with react-color-strip listed as a dependency so the CLI installs it automatically
  • Generated index files — entries added to registry/__index__.tsx, registry/bases/__index__.tsx (both radix and base sections), and examples/__index__.tsx for live preview
  • Style copiesstyles/radix-nova/ui/ and styles/base-nova/ui/ for the live docs preview renderer
  • Demosexamples/radix/color-picker.tsx and examples/base/color-picker.tsx showing controlled usage with a live color swatch
  • Docs — MDX pages for both base and radix styles, added to meta.json between collapsible and combobox
  • Dependencyreact-color-strip@^2.0.1 added to apps/v4/package.json

Props

Prop Type Default Description
value string Controlled hex color value
defaultValue string "#ef4444" Initial color for uncontrolled usage
onChange (value: string) => void Fires on every drag move
onChangeComplete (value: string) => void Fires on pointer release
showShade boolean false Show the shade strip below the hue strip
disabled boolean false Disables all interaction
className string Additional class names on the wrapper

Test plan

  • npx shadcn@latest add color-picker installs the component and react-color-strip in a fresh Next.js project
  • Hue strip drag updates color live
  • showShade renders the shade strip and its drag updates the full hex value
  • Resizing the container repositions the pointer correctly (ResizeObserver)
  • Controlled usage (value + onChange) and uncontrolled usage (defaultValue only) both work
  • disabled prop prevents interaction on both strips
  • Docs page renders at /docs/components/color-picker for both radix and base styles

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 17, 2026

@aviralj02 is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

Can you sign the commits please? See https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits. Thank you.

@aviralj02 aviralj02 marked this pull request as draft May 17, 2026 17:35
@aviralj02 aviralj02 marked this pull request as ready for review May 17, 2026 17:35
@aviralj02 aviralj02 marked this pull request as draft May 18, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant