# Color temperature slider

> Color temperature slider

A shadcn/ui block from the [@reui](https://reui.io) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/reui/c-slider-8).

- Page, with a live preview: https://shadcn.exchange/r/reui/c-slider-8
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/reui/c-slider-8-light-957360538826a6ed.png
- Registry item: https://reui.io/r/new-york-v4/c-slider-8.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://reui.io/r/new-york-v4/c-slider-8.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `label`, `slider`

## Files

### `c-slider-8.tsx`

```tsx
"use client"

import { useState } from "react"

import { Label } from "@/components/ui/label"
import { Slider } from "@/components/ui/slider"

export function Pattern() {
  const [temperature, setTemperature] = useState(4500)

  const getLabel = (temp: number) => {
    if (temp <= 3000) return "Warm"
    if (temp <= 4500) return "Neutral"
    if (temp <= 5500) return "Daylight"
    return "Cool"
  }

  return (
    <div className="mx-auto grid w-full max-w-sm gap-4">
      <div className="flex items-center justify-between">
        <Label className="text-sm font-medium">Color Temperature</Label>
        <span className="text-muted-foreground text-xs font-medium tabular-nums">
          {temperature}K &middot; {getLabel(temperature)}
        </span>
      </div>
      <div
        className="h-2 rounded-full"
        style={{
          background:
            "linear-gradient(to right, #ff8a2b, #ffd4a3, #fff5e6, #e8f0ff, #a3c9ff)",
        }}
      />
      <Slider
        value={[temperature]}
        onValueChange={(val) =>
          setTemperature(Array.isArray(val) ? (val[0] ?? 4500) : val)
        }
        min={2700}
        max={6500}
        step={100}
      />
    </div>
  )
}
```
