About
Examples of combining the Primitives to create a full color picker The following are examples of how you can combine the Primitives to create a full color picker.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Color Pickers [react-aria-components] to your project and fits it to your theme.
Code
How Color Pickers [react-aria-components] is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client"
import React from "react"
import { parseColor } from "react-aria-components"
import { Button } from "@/components/ui/button"
import {
ColorArea,
ColorField,
ColorPicker,
ColorSlider,
ColorSwatch,
ColorSwatchPicker,
ColorSwatchPickerItem,
ColorThumb,
SliderTrack,
} from "@/components/ui/color"
import { Dialog, DialogTrigger } from "@/components/ui/dialog"
import { Label } from "@/components/ui/field"
import { Popover } from "@/components/ui/popover"
import { Input } from "@/components/ui/textfield"
function HexPicker() {
let [color, setColor] = React.useState(parseColor("#f00"))
return (
<ColorPicker value={color} onChange={setColor}>
<DialogTrigger>
<Button variant="ghost" className="flex h-fit items-center gap-2 p-1">
<ColorSwatch className="size-8 rounded-md border-2" />
Hex Color
</Button>
<Popover placement="bottom start" className="w-fit">
<Dialog className="flex flex-col gap-4 p-3 outline-none">
<div>
<ColorArea
colorSpace="hsb"
xChannel="saturation"
yChannel="brightness"
className="h-[164px] rounded-b-none border-b-0"
>
<ColorThumb className="z-50" />
</ColorArea>
<ColorSlider colorSpace="hsb" channel="hue">
<SliderTrack className="rounded-t-none border-t-0">
<ColorThumb className="top-1/2" />
</SliderTrack>
</ColorSlider>
</div>
<ColorField colorSpace="hsb" className="w-[192px]">
<Label>Hex</Label>
<Input className="" />
</ColorField>
<ColorSwatchPicker className="w-[192px]">
<ColorSwatchPickerItem color="#F00">
<ColorSwatch />
</ColorSwatchPickerItem>
<ColorSwatchPickerItem color="#f90">
<ColorSwatch />
</ColorSwatchPickerItem>
<ColorSwatchPickerItem color="#0F0">
<ColorSwatch />
</ColorSwatchPickerItem>
<ColorSwatchPickerItem color="#08f">
<ColorSwatch />
</ColorSwatchPickerItem>
<ColorSwatchPickerItem color="#00f">
<ColorSwatch />
</ColorSwatchPickerItem>
</ColorSwatchPicker>
</Dialog>
</Popover>
</DialogTrigger>
</ColorPicker>
)
}
export { HexPicker }
![Color Pickers [react-aria-components] preview](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=1080,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/color/984/preview.png)
![Tag Group [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/tag-group/891/preview.png)
![Date Range Picker [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/date-range-picker/default/preview.png)
![Grid List [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/grid-list/default/preview.png)
![Switch [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/switch/1023/preview.png)
![Select [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/select/864/preview.png)
![Range Calendar [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/range-calendar/default/preview.png)

![Slider [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/slider/827/preview.png)







