Skip to content

Cell renderers

A cell renderer swaps a cell’s plain formatted text for richer presentation — a badge or chip, a progress bar, a star rating, a link / email / url / phone, tags, a mini chart, or any custom markup. It changes presentation only: the underlying value stays raw, so sort, filter, and aggregate keep working exactly as before. The engine still does all the math.

from dash_tensor_grid import TensorGrid, build_grid
payload = build_grid(sales, {
"rows": ["region", "country"],
"measures": {"revenue": "sum", "qty": "sum"},
"formats": {"revenue": "currency:USD"},
# Named renderers built into the component (shorthand, or {type, params}).
"cell_renderers": {
"qty": "badge",
"revenue": {"type": "progressBar", "params": {"min": 0, "max": 300, "showValue": True}},
},
})
TensorGrid(id="grid", row_data=payload["row_data"], column_defs=payload["column_defs"])
  • Two ways to render. The JS adapters take a per-column function — (value, node) => ReactNode (React), VNodeChild (Vue), or an HTML string (Vanilla) — returning null to fall back to the formatted value. The Dash component ships named renderers you reference by string in cell_renderers: charts sparkline / bar, and scalar widgets badge / chip / progressBar / link / rating / boolean / checkbox / email / url / phone / tags.
  • Params. Named renderers take a params map ({type: 'rating', params: {max: 5}}, {type: 'link', params: {href: 'https://x/{value}'}}).
  • The value stays raw, so the column still sorts and filters numerically and rolls up correctly — a renderer never becomes a source of truth.
  • For array-valued mini charts specifically, see sparklines; for value-driven color, style rules and color scales.