# Allocation Slider – Split 100% Across Segments with Draggable Dividers and Locks

> Allocation Slider for React and Tailwind CSS (shadcn/ui): drag a divider between segments and its two neighbours trade share, so the total always stays at 100. It is built to make splitting a whole feel direct: only the two segments you move roll to new shares and amounts while the rest hold still. Locked segments are skipped over, minimums stop the drag, double-click evens neighbours, Reset restores the start. Controlled or uncontrolled, keyboard sliders with aria-valuetext, reduced motion, light and dark. Use it for budgets, portfolio weights or team time. The included demo drags, locks and resets a monthly budget and makes no requests. Requires React only, with no animation library.

- Author: [DHxWhy](https://21st.dev/@dhxwhy)
- License: mit
- Tags: Slider, Range, Form, Input
- npm dependencies: lucide-react
- Live preview: https://21st.dev/@dhxwhy/components/allocation-slider

## Install

```bash
npx shadcn@latest add "https://21st.dev/r/dhxwhy/allocation-slider?api_key=$API_KEY_21ST"
```

Requires a 21st API key (generate one at https://21st.dev/mcp) passed as `API_KEY_21ST`. Free accounts get a limited number of installs per day; unlimited on a paid plan — see https://21st.dev/pricing.

Full component directory: https://21st.dev/llms.txt · More like this: https://21st.dev/community/components/s/slider.md
