<!-- https://svgrid.com/docs/recipes/conditional-row-coloring/ - SvGrid documentation as markdown. Index of every page: https://svgrid.com/llms.txt -->

# Conditional row coloring

> Live in [demo 62-conditional-styling](https://svgrid.com/demos/62-conditional-styling/).

> Live demo: Conditional styling - https://svgrid.com/demos/62-conditional-styling/

## When

rowClass returns a class map per row; CSS does the rest.

## How

Key API surface:

- `<SvGrid rowClass={(ctx) => ({...})}>`

See the demo source for the full implementation; this recipe pins the
pattern + the surface so you can copy-paste it confidently. The doc
page that explains the underlying feature in depth is linked from the
[recipes index](https://github.com/sv-grid/sv-grid/blob/main/docs/recipes/index.md).

## See also

- [Demo 62-conditional-styling source](https://github.com/sv-grid/sv-grid/blob/main/examples/src/demos/62-conditional-styling.svelte)
- [Demo 62-conditional-styling prompt sidecar](https://github.com/sv-grid/sv-grid/blob/main/examples/src/demos/prompts/62-conditional-styling.md) - drop into an LLM context window
- [Recipes index](https://github.com/sv-grid/sv-grid/blob/main/docs/recipes/index.md)

---

SvGrid is the Svelte 5 data grid (`npm install @svgrid/grid`, MIT). This page: https://svgrid.com/docs/recipes/conditional-row-coloring/ . All docs: https://svgrid.com/llms.txt
