Cell Slider
FreeA small bar with a number beside it for a table cell. It shows how far a value is, such as a quota used or a score.
npx wunderui-cli add cell-sliderPlayground
| Member | Quota used |
|---|---|
| Nora Lindgren | 68 |
| Daniel Okafor | 42 |
| Priya Raman | 91 |
| Member | Review score |
|---|---|
| Nora Lindgren | 4 |
| Daniel Okafor | 2 |
| Priya Raman | 5 |
| Member | Tasks done |
|---|---|
| Nora Lindgren | 9 |
| Daniel Okafor | 3 |
| Priya Raman | 12 |
Installation
npx wunderui-cli add cell-sliderWrites the source into your project with its dependencies and, on first use, the styles - see Installation.
Then import what you need:
import { CellSlider } from "@/components/wunderui/table-cells"Then use it inside a table cell:
import { CellSlider } from "@/components/ui/cell-slider"
import { TableCell } from "@/components/ui/table"
export function QuotaCell({ used }: { used: number }) {
return (
<TableCell>
<CellSlider value={used} max={100} />
</TableCell>
)
}Expected result: You see a thin grey bar with a primary-coloured fill and the number to its right. At a value of 68 the fill covers 68 % of the bar.
When to use
Use Cell Slider for
- Showing a level inside a table row, such as a quota used, a score or a share
- A column of bars that people compare at a glance
- Values that are set somewhere else and only read here
Value
The bar fills to the value out of the maximum: zero or less is empty, the maximum or more is full. The number always shows the value you passed.
| Member | Quota used |
|---|---|
| Nora Lindgren | 0 |
| Member | Quota used |
|---|---|
| Nora Lindgren | 50 |
| Member | Quota used |
|---|---|
| Nora Lindgren | 100 |
| Member | Quota used |
|---|---|
| Nora Lindgren | 130 |
| Member | Quota used |
|---|---|
| Nora Lindgren | -20 |
| Member | Quota used |
|---|---|
| Nora Lindgren | 30 |
Behavior and motion
What the cell slider shows and what it leaves out.
- Read-only
- CellSlider takes only a value and a maximum. It has no handler, cannot be focused or dragged and takes no key, so change the bar by changing the value.
- Fill
- The fill is clamped between 0 and 100 %: empty at 0 or below, full at the maximum or above. The number always shows what you passed, so 130 of 100 fills the bar and still reads 130.
- No role, no name
- The bar has no ARIA role or label, so a screen reader reads only the number. Name the measure in the column header and the row in a row header, and put the unit in the header.
- Number
- The number is the raw value in a 28 px box, right-aligned. Up to three digits line up in a column, and longer ones widen the box and shorten the bar.
- Width
- The cell is 112 px wide. Give its column about 160 px so the header and the bar line up.
- Figma states
- The Figma Editable Cell set shows a draggable Slider in six states, but in React CellSlider only displays a level. For a value people change, use Slider in the cell.
- Motion
- Nothing moves. The fill changes width in one step when the value changes.
- Reduced motion
- There is no movement to remove, so reduced motion changes nothing.
Anatomy
The figure marks one bar in its table: the column header, the row header, then the track, the fill and the number. CellSlider is the bar and the number, and the table comes from the Table parts.
| Member | Quota used |
|---|---|
| Nora | 68 |
- data-slot="table"
The table the cell sits in. The first column holds the row names, the header row names the columns, and the bar lives in a table cell.
- 1
The header of the bar column. It names the measure and the unit, such as Quota used, because the bar itself has no label.
- 2
The first cell of the row, marked as the row header. It says whose level the bar shows.
A small bar, 112 px wide, with a number beside it. It shows a value out of a maximum (default 100) and cannot be dragged, since it is a display, not a control.
- 3
The 4 px grey bar with fully rounded ends. It always spans the width left of the number.
- 4
The primary-coloured part of the track. Its width is the value divided by the maximum, capped at 100 %.
- 5
The raw value to the right of the bar, 12 px and right-aligned in 28 px, so the bar never has to be read on its own.
Best practices
- Do
Set the maximum to the real ceiling, such as 5 for a 5-point score or the seat limit of the row. The fill is clamped to the track, but the number still shows the raw value.
- Do
Put it in a column whose header names the measure and the unit, such as Quota used. The bar and number have no label or role of their own.
- Do
Mark the first cell of each row as a row header, so the number is read with its row.
- Do
Pair it with a control when the level can change, such as a button that completes a task. The slider then follows the value.
- Don’t
Don't build an editable cell around it. It has no handler, keyboard support or ARIA role, so use a Slider with an aria-label in the cell instead.
- Don’t
Don't use it for one task or upload with a label and a status. Progress has the role and the text for that.
- Don’t
Don't rely on the bar for values outside 0 to the maximum. It draws an empty or full bar there, and only the number shows the real figure.
- Don’t
Don't count on the Figma Editable Cell Slider states (View, Edit, Changed, Saving, Error, Disabled). The React cell shows a level only.
API reference
CellSlider is a plain function component with two props. It wraps no primitive and passes no other props through.
A small bar, 112 px wide, with a number beside it. It shows a value out of a maximum (default 100) and cannot be dragged, since it is a display, not a control.
| Prop | Type | Default | Description |
|---|---|---|---|
| value required | number | — | The level to show. The bar is clamped to 0 to : a negative value draws an empty bar and a value above a full one. The number beside the bar always shows the value as given. |
| max | number | 100 | The value that fills the whole bar. The default is 100. Set it to the real ceiling, such as 5 for a 5-point score. A of 0 or less draws an empty bar. |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("cell-slider")npx wunderui-cli add cell-sliderThe full library index for assistants is at /llms.txt.
Related components
Recent invoicesInvoices issued in the last 30 days Invoice Status Customer Amount INV-2041 Paid WunderUI $24,800.00 INV-2040 Open Halcyon Labs $3,200.00 INV-2039 Overdue Pergola Foods $980.00 INV-2038 Paid Marlow & Finch $12,400.00 Total Sum$41,380.00 Core Elements5 stylesTableRows and columns with 23 ready-made cell types; for sorting and search use Data Table.