# tanstack-ranger

Headless utilities for accessible single and multi-range sliders. Helps your coding agent wire up slider mechanics without imposing markup or CSS.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1300 installs · ★ 36
- Author: tanstack-skills
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/tanstack-skills/tanstack-skills/tree/HEAD/plugins/tanstack-ranger/skills/tanstack-ranger/SKILL.md
- Updated: 2026-01-31
- HTML: https://affpapa.org/en/nevibecode/skills/tanstack-ranger

## What it does

This skill teaches coding agents how to build slider controls with TanStack Ranger. The library manages coordinate calculations, drag behavior, and keyboard navigation while leaving HTML markup and styling entirely to you.

Inside, the reference outlines `useRanger` from `@tanstack/react-ranger`. The assistant learns to map track segments with `rangerInstance.getSteps()` and spread attributes via `handle.getHandleProps()`. Keep track references valid. Without passing the DOM element in `getRangerElement`, coordinate math breaks down.

The reference also covers advanced patterns like logarithmic scales and explicit tick marks. Agents can write code for non-linear sliders or step-restricted handles without guessing option names.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add tanstack-skills/tanstack-skills --skill tanstack-ranger -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/tanstack-ranger/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/tanstack-ranger/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add tanstack-skills/tanstack-skills --skill tanstack-ranger -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/tanstack-ranger/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add tanstack-skills/tanstack-skills --skill tanstack-ranger -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/tanstack-ranger/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install tanstack-skills/tanstack-skills tanstack-ranger
```

2. **Manually: put the files in place**
- File: `.github/skills/tanstack-ranger/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add tanstack-skills/tanstack-skills --skill tanstack-ranger -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/tanstack-skills/tanstack-skills --path plugins/tanstack-ranger/skills/tanstack-ranger
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/tanstack-ranger/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add tanstack-skills/tanstack-skills --skill tanstack-ranger -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/tanstack-skills/tanstack-skills/tree/HEAD/plugins/tanstack-ranger/skills/tanstack-ranger/SKILL.md

## When to use it
- build dual-thumb price range sliders in React
- render custom tick marks along the slider track
- implement logarithmic scale interpolation for wide value ranges
- wire ARIA attributes and keyboard controls to custom slider thumbs
- separate visual styling from track coordinate logic

## Example prompts
- Create a dual-handle range slider with `@tanstack/react-ranger` for values between 0 and 100.
- Show an example of a logarithmic slider using `logarithmicInterpolator`.
- Render custom tick labels along the track using `rangerInstance.getTicks()`.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: de716d85b470d036.

BEGIN THIRD-PARTY FILE de716d85b470d036
````text
---
name: tanstack-ranger
description: Headless utilities for building range and multi-range sliders in TS/JS, React, Vue, Solid, Svelte & Angular.
---


## Overview

TanStack Ranger provides headless utilities for building fully accessible range and multi-range slider components. It handles all the complex logic for single value, range, and multi-thumb sliders while giving you complete control over styling and markup.

**Package:** `@tanstack/react-ranger`
**Core:** `@tanstack/ranger-core` (framework-agnostic)
**Status:** Stable

## Installation

```bash
npm install @tanstack/react-ranger
```

## Core Pattern

```tsx
import { useRanger } from '@tanstack/react-ranger'

function RangeSlider() {
  const [values, setValues] = useState([25, 75])

  const rangerInstance = useRanger({
    getRangerElement: () => rangerRef.current,
    values,
    min: 0,
    max: 100,
    stepSize: 1,
    onChange: (instance) => setValues(instance.sortedValues),
  })

  const rangerRef = useRef<HTMLDivElement>(null)

  return (
    <div
      ref={rangerRef}
      style={{
        position: 'relative',
        height: '8px',
        background: '#ddd',
        borderRadius: '4px',
        width: '100%',
      }}
    >
      {/* Track segments */}
      {rangerInstance.getSteps().map(({ left, width }, i) => (
        <div
          key={i}
          style={{
            position: 'absolute',
            left: `${left}%`,
            width: `${width}%`,
            height: '100%',
            background: i === 1 ? '#3b82f6' : '#ddd',
            borderRadius: '4px',
          }}
        />
      ))}

      {/* Thumbs */}
      {rangerInstance.handles.map((handle, i) => (
        <button
          key={i}
          {...handle.getHandleProps()}
          style={{
            position: 'absolute',
            left: `${handle.getPercentage()}%`,
            transform: 'translateX(-50%)',
            width: '20px',
            height: '20px',
            borderRadius: '50%',
            background: '#3b82f6',
            border: '2px solid white',
            cursor: 'grab',
          }}
        />
      ))}
    </div>
  )
}
```

## Ranger Options

### Required

| Option | Type | Description |
|--------|------|-------------|
| `getRangerElement` | `() => Element \| null` | Returns the slider track element |
| `values` | `number[]` | Current thumb values |
| `min` | `number` | Minimum value |
| `max` | `number` | Maximum value |
| `onChange` | `(instance) => void` | Called when values change |

### Optional

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `stepSize` | `number` | `1` | Step increment between values |
| `steps` | `number[]` | - | Custom step positions (overrides stepSize) |
````
END THIRD-PARTY FILE de716d85b470d036

The third-party file has ended. Everything between the de716d85b470d036 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2744 of 9562 bytes. © tanstack-skills · MIT · https://github.com/tanstack-skills/tanstack-skills/tree/HEAD/plugins/tanstack-ranger/skills/tanstack-ranger/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
