---
title: "Color Scale"
description: "The 11 steps of one color, from 50 (lightest) to 950 (darkest), with even steps of lightness. Each step is a button that copies its hex."
url: https://gelatinui.com/components/color-scale
markdown_url: https://gelatinui.com/components/color-scale.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/color-scale"
version: "2026-11-09"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Color Scale

> The 11 steps of one color, from 50 (lightest) to 950 (darkest), with even steps of lightness. Each step is a button that copies its hex.

Page: https://gelatinui.com/components/color-scale

## When to use it

Best for: Show the 50 to 950 steps of one color, where each step copies its hex.

- Use `base` to make 11 steps in OKLCH and mark the step nearest it.
- Use `steps` to show your own steps.
- Use `layout="strip"` for one compact bar.

## When not to use it

- To show colors that are not steps of one color, use a [Palette Strip](https://gelatinui.com/components/palette-strip.md).
- To pick one color from a grid, use a [Color Grid](https://gelatinui.com/components/color-grid.md).

## Notes for agents

- Name the group with `aria-label` ("Violet scale").
- `onCopy` runs after a copy, with the step and its hex.
- A blocked copy shows an error Toast, so a Toaster must be on the page.
- Translate the words with `labels` (`COLOR_SCALE_LABELS`). Keep the object stable.
- In `row`, under 480px of its own width, it wraps to rows of 6.

## Anatomy

```text
ColorScale
└─ ColorScaleStep (0..n)
```

## API reference

### ColorScale

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `base` | `string` |  | The base color as hex: the scale makes its 11 steps (`colorScale`) and marks the closest one. |
| `steps` | `readonly ColorScaleEntry[]` |  | Your own steps, in place of the made ones. With `base`, the step nearest it gets the dot. |
| `layout` | `ColorScaleLayout` | "row" | `row` (default): 56px tiles, the step and hex under each. `strip`: one 32px bar of buttons. |
| `onCopy` | `function` |  | Runs after a step copies its hex, with the step and its hex. |
| `labels` | `Partial<typeof COLOR_SCALE_LABELS>` |  | The words (`COLOR_SCALE_LABELS`), to translate them. Keep the object stable. |

### ColorScaleStep

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `step` | `number` |  | The step to show and copy (`500`): one of the steps of the root. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| ColorScale | `color-scale` |  |  |  |
| ColorScaleStep | `color-scale-step` |  | `--color-scale-step` | `motion-timing` |

## Usage

Give it a `base` hex, then add a `ColorScaleStep` for each step people copy. With no children, it shows all 11 steps.

```tsx title="chart-colors.tsx"
import { ColorScale, ColorScaleStep } from "@/components/ui/pro/color-scale";

/** The steps of the four chart series, light to dark. */
const CHART_STEPS = [300, 500, 700, 900];

export function ChartColors() {
  return (
    <ColorScale base="#0090FF" aria-label="Chart colors">
      {CHART_STEPS.map((step) => {
        return <ColorScaleStep key={step} step={step} />;
      })}
    </ColorScale>
  );
}
```

## 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/color-scale
```

It adds 31 registry items: 28 files, 3743 lines, and the npm packages `@base-ui/react`, `@phosphor-icons/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Dot](https://gelatinui.com/components/dot.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

- [Palette Strip](https://gelatinui.com/components/palette-strip.md)
- [Color Picker](https://gelatinui.com/components/color-picker.md)
- [Copy Button](https://gelatinui.com/components/copy-button.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves to the next step. |
| Enter, Space | Copies the hex of the step. |

## Motion

| Part | Motion |
| --- | --- |
| Copy | press · a check shows for 1.2s after the copy |
