Conditional Cell Styling
In order to add conditional cell styles, follow this guide.
Like in excel, it is possible to add conditional cell styling to your table. This is an awesome feature that may help you a lot.
For example, imagine you have a table with the grades on some students. If the grade is bigger than 70, you want to apply a custom style to the cell (e.g. a green background) and if not, another custom style (e.g. red background)
In order to have a table with conditional cell styles, apply this code.
Conditional Cell Style Props.
conditionalCellStyle
objects array
columns
array of the columns in which this conditional style will be applied.
styleTrue
Style if validation returns true
styleFalse
Style if validation returns false
validation
Function that must return true or false in order to apply a style. Is the parameter as the current cell value in order to define the styling rule.
defaultStyle
Style if validations do not return true nor false
CodeSandbox example https://codesandbox.io/s/crimson-sky-4vxdf?file=/src/App.js
Last updated
Was this helpful?