This guide covers changes to the beta DataTable component. These APIs may continue to evolve before the stable release.
Overview
This guide continues the work started in Column Types and EditConfig, which introduced theeditConfig property and the text, select, and multiselect edit modes. That guide also outlined how the editConfig structure supports new edit modes with mode-specific options — the number edit mode is the first to use this pattern.
The DataTable now supports a dedicated number edit mode for inline editing of numeric cell values:
editConfig.mode: "number"- Renders a formatted number input with validation, decimal precision, and keyboard increment/decrement- Number-specific options - Configure
minValue,maxValue,step, and fraction digit precision directly oneditConfig
Design Rationale
Why a dedicated number mode?
The text edit mode previously accepted number values by converting them to strings:- Values lost their numeric type, requiring manual parsing in
onChange - No input validation for numeric constraints like min/max
- No keyboard increment/decrement support
- No decimal precision formatting
Relationship between type and editConfig
The type property controls how a value is displayed when the cell is not being edited. The editConfig controls the editing behavior. These are independent concerns:
Number Edit Options Reference
Number-specific options are set directly on theeditConfig object alongside mode and onChange. All options are optional.
| Option | Type | Description |
|---|---|---|
minValue | number | Minimum allowed value |
maxValue | number | Maximum allowed value |
step | number | Increment/decrement step for arrow key navigation |
minimumFractionDigits | number | Minimum decimal places displayed |
maximumFractionDigits | number | Maximum decimal places allowed |
useNumberField hook configuration.
Basic number editing
Currency editing with decimal precision
Migration Guide
Numeric columns using text edit mode
If you were usingeditMode: "text" or editConfig.mode: "text" for numeric data, switch to number mode:
Numeric columns using editConfig text mode
Breaking Changes
The following change is breaking:- Text edit mode no longer accepts
numbervalues - Previously, a cell withmode: "text"and a numeric value would silently convert the number to a string. Now, the cell falls back to a read-only state and logs a console warning directing you to usemode: "number"instead.
Why breaking?
Since DataTable is a beta component, we opted to remove the implicit coercion rather than maintain a deprecation path. The coercion masked type mismatches and produced a suboptimal editing experience for numeric data. The new number edit mode is the correct replacement.New Exports
The following types are now exported from@servicetitan/anvil2:
NumberEditConfig- Edit configuration type formode: "number"columns