Add AG Grid theme customization guide to documentation#6432
Conversation
Expand the AG Grid theming docs to cover overriding the built-in themes with `--ag-*` CSS variables, scoping overrides under a wrapper class, inline `style` overrides on the grid (with notes on specificity and `!important`), and per-cell custom classes via cellClass / cellClassRules.
Greptile SummaryThis PR extends
Confidence Score: 3/5The PR should not merge as-is; the cellClassRules string expression examples are factually incorrect and will not work for users who copy them. A P1 documentation bug — params.value in AG Grid string expressions silently produces no output and is directly contradicted by official AG Grid docs — warrants a below-ceiling score. The rest of the content is well-structured but the incorrect example needs to be fixed before merging. docs/enterprise/ag_grid/theme.md — the cellClassRules section (lines 208–221) Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User selects theme prop] --> B{Built-in theme class applied to grid root element}
B --> C[.ag-theme-quartz / balham / alpine / material]
C --> D{How to customize?}
D --> E[External stylesheet assets/ag_grid_theme.css]
D --> F[Inline style dict --ag-* variables]
D --> G[cellClass / cellClassRules per-cell conditional classes]
E --> H[Load via rxe.App stylesheets param]
F --> I[Set on grid element]
G --> J[JS string expression: value or x available NOT params.value]
H --> K[Scoped to .custom-ag-grid wrapper to avoid leakage]
Reviews (1): Last reviewed commit: "docs(ag-grid): document custom theming v..." | Re-trigger Greptile |
| - `cellClassRules` is a mapping of `class name -> JS expression`; the class is applied when the expression evaluates truthy. The cell's value is available as `params.value`. | ||
|
|
||
| ```python | ||
| column_defs = [ | ||
| {"field": "project"}, | ||
| { | ||
| "field": "status", | ||
| "cellClass": "status-pill", | ||
| "cellClassRules": { | ||
| "status-active": "params.value === 'Active'", | ||
| "status-blocked": "params.value === 'Blocked'", | ||
| "status-complete": "params.value === 'Complete'", | ||
| "status-planning": "params.value === 'Planning'", | ||
| }, |
There was a problem hiding this comment.
params is not in scope for cellClassRules string expressions
AG Grid string expressions for cellClassRules are evaluated in a context where the cell value is exposed as value (and aliased as x), but params is not a top-level variable (AG Grid expressions docs). Using params.value will silently evaluate to undefined, making every expression falsy — no status classes will ever be applied.
The text above the example also says "The cell's value is available as params.value", which reinforces this mistake. Use value instead.
| - `cellClassRules` is a mapping of `class name -> JS expression`; the class is applied when the expression evaluates truthy. The cell's value is available as `params.value`. | |
| ```python | |
| column_defs = [ | |
| {"field": "project"}, | |
| { | |
| "field": "status", | |
| "cellClass": "status-pill", | |
| "cellClassRules": { | |
| "status-active": "params.value === 'Active'", | |
| "status-blocked": "params.value === 'Blocked'", | |
| "status-complete": "params.value === 'Complete'", | |
| "status-planning": "params.value === 'Planning'", | |
| }, | |
| - `cellClassRules` is a mapping of `class name -> JS expression`; the class is applied when the expression evaluates truthy. The cell's value is available as `value` (or the shorthand `x`). | |
| ```python | |
| column_defs = [ | |
| {"field": "project"}, | |
| { | |
| "field": "status", | |
| "cellClass": "status-pill", | |
| "cellClassRules": { | |
| "status-active": "value === 'Active'", | |
| "status-blocked": "value === 'Blocked'", | |
| "status-complete": "value === 'Complete'", | |
| "status-planning": "value === 'Planning'", | |
| }, | |
| }, | |
| ] |
| ```md alert warning | ||
| # CSS variable inheritance and `!important` | ||
| Inline `style` sets the variable on the grid root element only. The built-in themes bind their styling to multiple CSS classes (`.ag-theme-quartz`, `.ag-theme-quartz .ag-cell`, etc.), and those rules often have higher specificity than a custom property defined inline. As a result, a value set via `style={"--ag-font-family": "..."}` may be ignored unless you append `!important`. If your inline override doesn't take effect, add `!important` or move the override into a stylesheet that targets the theme class with comparable specificity. | ||
|
|
||
| Inline `style` overrides only apply to the grid they are set on. To customize multiple grids consistently, prefer a stylesheet scoped to a wrapper class (see above). | ||
| ``` |
There was a problem hiding this comment.
Specificity explanation is inaccurate
The warning attributes the need for !important to CSS specificity, but CSS custom property declarations follow the cascade, not traditional specificity rules. Inline styles already win over class-selector declarations for custom properties without !important. The actual reason an inline override may fail is that some AG Grid builds declare their theme variables with !important themselves, or that Reflex's style serialization strips unknown CSS properties. The current explanation may confuse users who test their own overrides and find they work fine without !important.
Type of change
Description
This PR adds comprehensive documentation for customizing AG Grid themes in
reflex-enterprise. The new section covers:stylesheetsparameter onrxe.Appstyledict, with a warning about specificity and!importantcellClassandcellClassRulesto apply conditional styling to individual cells based on their valuesThe documentation includes practical code examples for each approach, making it easy for users to customize AG Grid appearance to match their design requirements.
Changes
docs/enterprise/ag_grid/theme.mdwith 176 lines of new documentation and examples covering theme customization techniqueshttps://claude.ai/code/session_01AZ83QRYVb3yyCYPqGdphYz