This page has thin source coverage. Examples are derived from code configuration templates. Verify specific expression syntax and available context variables in the application.
Formatter Definition
| Property | Type | Default | Description |
|---|---|---|---|
formatters | object | {} | Top-level section containing named formatter definitions. Each key is a formatter name referenced by columns. |
formatters.<name> | array | [] | Array of conditional rules for this formatter. Rules are evaluated in order. |
formatters.<name>[].expression | string | None | JavaScript expression that evaluates to true or false. When true, the associated style is applied to the cell. |
formatters.<name>[].style | string | None | Name of a style defined in the styles section or a predefined style. Applied when the expression evaluates to true. |
Formatter Evaluation Flow
Basic Formatter
A formatter that always applies a style (unconditional):Multiple Rules
A formatter can contain multiple rules evaluated in order. Each matching rule applies its style.The exact expression syntax and available context variables for conditional expressions depend on the runtime environment. Common patterns include
'true' for unconditional styling and JavaScript expressions accessing cell context.Predefined Formatter Behavior
ThereadOnly formatter name has special significance. When a column references formatter: readOnly, the column is rendered as read-only with appropriate visual styling, replacing the deprecated isreadOnly column property.
Relationship Between Formatters, Styles, and Columns
| Configuration Section | Purpose | References |
|---|---|---|
columns.<key>.formatter | Assigns a formatter to a column | Formatter name |
formatters.<name> | Defines conditional rules | Style name |
styles.<name> | Defines visual properties | Color tokens |
Complete YAML Example
Related Pages
- Styles — named style definitions referenced by formatters
- Conditional Formatting — advanced conditional styling patterns
- Column Properties — the
formattercolumn property - Header Styles — styling column headers (separate from cell formatters)
Source references: powersheet.yaml, whole_rtm.template.yaml
Sources
Sources
KB ArticlesSource Code
prod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/configurations/whole_rtm.template.yamlpowersheet.yamlprod-powersheet-src/com.nextedy.powersheet.client/src/modules/Powersheet/Powersheet.tsxprod-powersheet-src/com.nextedy.powersheet.client/ltc-repo/packages/common/types/api/document.tsprod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/configurations/constraints_composing.template.yaml