Sorry, but you either have no stories or none are selected somehow.
If the problem persists, check the browser console, or the terminal you've run Storybook from.
| Property | Type | Required | Description |
|---|---|---|---|
| when | function: row => row.<yourfield> | yes | when accepts a callback that gives you access to your data. The when callback must return a boolean to determine if the style will be applied. e.g. row => row.status === 'completed' will apply the style when the row.status field is completed |
| style | object or (row) => object | no | Accepts a css-in-js style object. Alternativly, you can also specify callback that has access to the row props. e.g. (row) => ({ backgroundColor: row.isSpecial ? 'pink' : inherit }) |
| classNames | string[] | no | In some cases you may want to apply conditional classNames. Accepts an array of classes: e.g. ['class1', 'class2']. |
A Conditional Style Object allows you to apply a specific style object based on you data:
For example, let's say you want to apply a style when calories exceed 300:
Alternativly, you can use a callback instead of a style object that has access to the row data:
RDT allows you to override styling based on your data. Currently, you can apply conditional logic for rows using the DataTable property `
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| conditionalRowStyles | array | no | [] | Allows an array of conditional style objects |
style ObjectThe following will style the background color of a row to green and set a hover effect when the expression row => row.calories < 300 evaluates to true
classNames arrayYou can apply classNames instead or in addition to style:
Note: classNames are applied to the TableRow component and concatenated to the rdt_TableRow class:
style ObjectYou can also style individual cells by applying conditionalCellStyles to a column definition:
classNames ObjectAs with conditionalRows you can also apply classNames to a column cell instead of or in addition to style:
Note: classNames are applied to the TableCell component and concatenated to the rdt_TableCell class: