Skip to main content
tally-react draws every cell with a renderer and edits it with an editor. Both are plain components, looked up by the column’s type. Pass your own through the renderers and editors props of <Tally>.

Lookup

A renderer is found by the type name first, then by the type kind. The same rule picks editors. Your entries are merged over defaultRenderers and defaultEditors.
bool, person, bar, email and url have renderers keyed by type name. A renderer keyed by their kind does not reach them. Override them by name.
The same renderer draws the cell in the grid, the field on a card and the label of a group row.

Renderers

A renderer receives CellProps and returns a node.
renderers.tsx
Use text for display so locale and numbering system stay right. Use value for decisions such as a sign or a threshold.

Column options for the default renderers

Four column options shape the built-in renderers without any code.
schema.ts
Subtitles and relative lines hide at compact density. A sparkline needs at least two numbers. With format.signed, the sparkline takes the color of the sign.

Width

width is a fixed width in pixels. A column with flex grows into spare viewport width in proportion to its value, and its width stays the floor. The column menu toggles it with Fill remaining width. Fit width measures the rendered cells. Dragging a resize handle sets a fixed width again. See Pinning and column layout.

Editors

An editor renders while a cell is being edited. It receives CellEditorProps. move is 'down', 'up', 'right' or 'left'. It decides where the active cell goes after the commit. The default editors commit with down on Enter, up on Shift + Enter, right on Tab and left on Shift + Tab, and without a move on blur.
editor.tsx
Call commit or cancel once. Focus returns to the grid when the editor closes, which blurs the input, so guard against a second call as above. The committed value goes through the column type’s parse. A value that does not parse is dropped, and an empty value becomes null. Each commit is one mutation, so undo reverts it. Boolean columns have no editor. Enter or a double click toggles the value.

Wiring

Define renderers and editors outside the component, or memoize them. A new object on every render re-renders every cell.