---
title: "Gradient Picker"
description: "Make a linear, radial, or conic CSS gradient. Move, add, and remove color stops on a track, and set the color and angle."
url: https://gelatinui.com/components/gradient-picker
markdown_url: https://gelatinui.com/components/gradient-picker.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/gradient-picker"
version: "2026-11-09"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Gradient Picker

> Make a linear, radial, or conic CSS gradient. Move, add, and remove color stops on a track, and set the color and angle.

Page: https://gelatinui.com/components/gradient-picker

## When to use it

Best for: Make a linear, radial, or conic CSS gradient with color stops, in an editor panel.

- Use it when people make a gradient, not only one color.
- Use `name` to send the CSS text (`linear-gradient(90deg, …)`) with a form.
- Use `gradientToCss(value)` to paint the result on the page.

## When not to use it

- To pick one color, use a [Color Picker](https://gelatinui.com/components/color-picker.md).
- To show the colors of a palette, use a [Palette Strip](https://gelatinui.com/components/palette-strip.md).

## Notes for agents

- The value is a `Gradient` from `lib/gradient-model.ts`: type, angle, and stops with ids and hex colors.
- A gradient keeps 2 stops or more. Add puts a stop in the largest gap.
- `onValueChange` gets the change details. Call `cancel()` on them to stop a change.
- The editor, the position field, and Remove act on the active stop (`activeStop`).
- With no children it renders the type, the preview, the track, the stop row, the editor, and the angle.

## Anatomy

```text
GradientPicker
├─ GradientPickerType (0..n)
├─ GradientPickerPreview (0..n)
├─ GradientPickerTrack (0..n)
├─ GradientPickerStop (0..n)
├─ GradientPickerStopLabel (0..n)
├─ GradientPickerPosition (0..n)
├─ GradientPickerAdd (0..n)
├─ GradientPickerRemove (0..n)
├─ GradientPickerEditor (0..n)
└─ GradientPickerAngle (0..n)
```

## API reference

### GradientPicker

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | The parts. Default: type, preview, track, stop row, editor, and angle. |
| `value` | `Gradient` |  | The gradient, controlled. |
| `defaultValue` | `Gradient` | DEFAULT_GRADIENT | The first gradient, uncontrolled. Default: blue to violet, linear at 90°. |
| `onValueChange` | `function` |  | Each change: a type, an angle, a stop move, color, add, or remove. `cancel` stops it. |
| `activeStop` | `string` |  | The id of the stop that the editor, the position field, and Remove act on, controlled. |
| `defaultActiveStop` | `string` |  | The first active stop. Default: the first stop from the start. |
| `onActiveStopChange` | `function` |  |  |
| `disabled` | `boolean` | false |  |
| `name` | `string` |  | The form name: the form sends the CSS text (`linear-gradient(90deg, …)`). |
| `form` | `string` |  | The `form` of the hidden input, for a picker outside its form. |
| `labels` | `Partial<typeof GRADIENT_PICKER_LABELS>` |  | The words (`GRADIENT_PICKER_LABELS`). Keep the object stable. |

### GradientPickerType

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `fullWidth` | `boolean` | true |  |
| `orientation` | `"horizontal" \| "vertical"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "lg" \| "sm" \| "xs"` | "sm" |  |

Also takes every prop of Base UI `RadioGroup`: https://base-ui.com/react/components/radio-group

### GradientPickerPreview

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### GradientPickerTrack

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Slider.Root`: https://base-ui.com/react/components/slider

### GradientPickerStop

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### GradientPickerStopLabel

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### GradientPickerPosition

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `NumberField.Root`: https://base-ui.com/react/components/number-field

### GradientPickerAdd

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### GradientPickerRemove

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### GradientPickerEditor

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### GradientPickerAngle

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `onValueCommitted` | `function` |  | The end of a change: a release, a key, a typed value. Not on Escape. |
| `range` | `AngleDialRange` |  | `wrap` (default): 0 to 359. `signed`: −180 to 180. Both wrap at the ends. |
| `step` | `number` |  | The step of a drag and of the arrow keys, in degrees. Use a step that divides 360. Default 1. |
| `snapStep` | `number` |  | The snap of Shift (a drag and Shift + arrow), in degrees. Default 15. Use a multiple of `step`: the value then snaps to the step grid, which would undo a snap between two steps. |
| `variant` | `AngleDialVariant` | "row" | `default`: the dial beside its text. `row`: a 32px panel row with a 24px dial at the end. |
| `size` | `AngleDialSize` |  | The dial: `sm` 24, `default` 64, `lg` 96. In a row: the row height, 28, 32, or 36. |
| `disabled` | `boolean` |  |  |
| `readOnly` | `boolean` |  | The value shows and can be focused, read, and submitted, but not changed. |
| `name` | `string` |  | The form name of the hidden range input. |
| `form` | `string` |  | The `form` of the hidden range input, for a dial outside its form. |
| `locale` | `string` |  | The locale of the number format. |
| `format` | `NumberFormatOptions` |  | The format of the shown value. Default: the narrow degree unit with the digits of the step. |
| `getAriaValueText` | `function` |  | The spoken value (`aria-valuetext`). Default: "135 degrees" in the locale. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| GradientPicker | `gradient-picker` |  |  |  |
| GradientPickerType | `gradient-picker-type` |  |  |  |
| GradientPickerPreview | `gradient-picker-preview` |  | `--gradient-picker-fill` | `pattern` |
| GradientPickerTrack | `gradient-picker-track` | `data-disabled` | `--gradient-picker-track` | `pattern` |
| GradientPickerStop | `gradient-picker-stop` |  |  |  |
| GradientPickerStopLabel | `gradient-picker-stop-label` |  |  |  |
| GradientPickerPosition | `gradient-picker-position` |  |  |  |
| GradientPickerAdd | `gradient-picker-add` |  |  |  |
| GradientPickerRemove | `gradient-picker-remove` |  |  |  |
| GradientPickerEditor | `gradient-picker-editor` |  |  |  |
| GradientPickerAngle | `gradient-picker-angle` |  |  |  |

## Usage

Compose the parts in the order people use them: type, preview, track, stop row, color editor, and angle. `name` sends the CSS text with a form.

```tsx title="background-gradient.tsx"
import {
  GradientPicker,
  GradientPickerAdd,
  GradientPickerAngle,
  GradientPickerEditor,
  GradientPickerPosition,
  GradientPickerPreview,
  GradientPickerRemove,
  GradientPickerStop,
  GradientPickerStopLabel,
  GradientPickerTrack,
  GradientPickerType,
} from "@/components/ui/pro/gradient-picker";

export function BackgroundGradient() {
  return (
    <GradientPicker name="background" className="w-62">
      <GradientPickerType />
      <GradientPickerPreview />
      <GradientPickerTrack />
      <GradientPickerStop>
        <GradientPickerStopLabel />
        <GradientPickerPosition />
        <GradientPickerAdd />
        <GradientPickerRemove />
      </GradientPickerStop>
      <GradientPickerEditor />
      <GradientPickerAngle />
    </GradientPicker>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/gradient-picker
```

It adds 95 registry items: 90 files, 14924 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@phosphor-icons/react`, `@xstate/react`, `clsx`, `motion`, `react-aria-components`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Angle Dial](https://gelatinui.com/components/angle-dial.md)
- [Button](https://gelatinui.com/components/button.md)
- [Color Area](https://gelatinui.com/components/color-area.md)
- [Color Field](https://gelatinui.com/components/color-field.md)
- [Color Picker](https://gelatinui.com/components/color-picker.md)
- [Color Slider](https://gelatinui.com/components/color-slider.md)
- [Direction](https://gelatinui.com/components/direction.md)
- [Number Field](https://gelatinui.com/components/number-field.md)
- [Segmented Control](https://gelatinui.com/components/segmented-control.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Color Picker](https://gelatinui.com/components/color-picker.md)
- [Color Area](https://gelatinui.com/components/color-area.md)
- [Palette Strip](https://gelatinui.com/components/palette-strip.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Arrow keys | Moves the focused stop 1%. |
| Shift + arrow keys | Moves the focused stop 10%. |
| Home, End | Moves the focused stop to the next stop, or to the end. |
| Delete, Backspace | Removes the focused stop. A gradient keeps 2 stops. |

## Motion

| Part | Motion |
| --- | --- |
| Add | indicator · 200ms · the new stop thumb grows from 0.5 and fades in |
| Thumb | press · 100ms · the thumb grows to 1.1 on hover, 1.25 on drag, and 1.5 when active |
