Formatters provide conditional cell styling based on runtime data. Each formatter is a named array of rules. When a cell renders, Powersheet evaluates each rule’s expression against the current cell context. If the expression returns true, the associated style is applied to that cell.
Complex JavaScript expressions in formatters are not recommended. Keep expressions simple — use straightforward property comparisons and boolean logic. Complex multi-line expressions may cause rendering issues.
The formatter value on a column must exactly match a key defined in the formatters section. A mismatched name results in no formatting being applied with no error message.
The isReadOnly column property and formatters serve different purposes. Use isReadOnly: true on a column to prevent editing regardless of formatting. Use a formatter with style: readOnly for visual read-only indication. The isReadOnly value may be overwritten by user permissions or global document configuration.
A formatter can contain multiple rules. All rules are evaluated in order, and each matching rule applies its style. When multiple rules match, the later rule’s style properties override earlier ones for the same CSS property.
Formatters reference styles by name. Powersheet provides 20 built-in styles that can be used directly without defining a custom styles section. See Styles for the full list.Commonly used predefined styles with formatters:
Style Name
Visual Effect
Typical Use
readOnly
Read-only cell indicator
Mark non-editable columns
boldTitle
fontWeight: 600
Emphasize key columns
unsupported
Grey background + line-through
Deprecated or unsupported values
red
Red text on light red background
High severity / critical status
darkred
Red text on darker red background
Very high severity
orange
Orange text on light orange background
Medium severity / warning
darkorange
Orange text on darker orange background
Elevated severity
green
Green text on light green background
Low severity / approved status
darkgreen
Green text on darker green background
Confirmed / verified status
blue
Blue text on light blue background
Informational highlights
grey
Grey text on light grey background
Inactive or informational
darkgrey
Grey text on darker grey background
Disabled or archived
teal
Teal text on light teal background
Secondary categorization
When a formatter references a style name, Powersheet first checks custom styles defined in the styles section, then falls back to built-in styles. A custom style with the same name as a built-in style overrides the built-in.
Formatters are typically applied at the column level. When a formatter is referenced from a column that spans the full row (such as an outline number column), the visual effect appears to apply to the entire row.
Views can override column properties including the formatter reference. A view can assign a different formatter to a column or remove formatting entirely.
The Base View is the state defined by the root columns section. Views extend the Base View by overriding specific column properties. If no views are defined or no default view is specified, the Base View is applied automatically.
A requirements traceability sheet configuration with formatters for severity, status, and read-only columns using the standard RTM entity hierarchy (UserNeed > SystemRequirement > DesignRequirement > Hazard > RiskControl):
✅ Use predefined styles whenever possible rather than defining custom inline styles. The 20 built-in styles cover most color coding needs.✅ Keep expressions simple. Use straightforward property comparisons (==, <=, >, !) and avoid multi-line or deeply nested JavaScript.✅ Name formatters descriptively. A name like severityFormat is clearer than fmt1 when reviewing configuration.✅ Separate concerns. Define styles in the styles section and reference them from formatters rather than using inline style objects. This promotes reuse across multiple formatters.✅ Order rules intentionally. When multiple rules can match, later rules override earlier ones for the same CSS property. Place higher-priority styles last.⚠️ Avoid complex expressions. Simple boolean expressions are recommended. Complex JavaScript in formatter expressions may cause unexpected behavior.⚠️ Do not confuse formatter and render. The formatter property controls cell styling (colors, fonts). The render property controls cell content rendering (custom HTML output). See Render Property.
The full conditional formatting system connects three configuration sections in a chain: the column references a formatter by name, the formatter evaluates expressions and references a style, and the style defines the visual properties.