Skip to content
WunderUI

Cell Slider

Free

A 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-slider

Playground

MemberQuota used
Nora Lindgren
68
Daniel Okafor
42
Priya Raman
91

Installation

bash
npx wunderui-cli add cell-slider

Writes the source into your project with its dependencies and, on first use, the styles - see Installation.

Then import what you need:

tsx
import { CellSlider } from "@/components/wunderui/table-cells"

Then use it inside a table cell:

tsx
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

Use something else for

  • Slider for a value the person changes by dragging or with the arrow keys
  • Progress for the completion of one task or upload, with a label and a role
  • Meter for a value in a known range with thresholds, such as disk usage

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.

MemberQuota used
Nora Lindgren
0

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.

MemberQuota 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.

  • The header of the bar column. It names the measure and the unit, such as Quota used, because the bar itself has no label.

  • 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.

  • The 4 px grey bar with fully rounded ends. It always spans the width left of the number.

  • The primary-coloured part of the track. Its width is the value divided by the maximum, capped at 100 %.

  • 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.

PropTypeDefaultDescription
value requirednumber—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.
maxnumber100The 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.

MCPget_component("cell-slider")
Installnpx wunderui-cli add cell-slider

The full library index for assistants is at /llms.txt.