-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: How to personalize each ".BaseTable__row-cell" style according with its value? #131
Comments
hey, you can use |
Can I access the column props using BaseTable component? I'm not using Column component |
I got it!! I manipulated the column array adding the className props before passing it to the BaseTable component. Thank you for the quick response!! const getClasses = ({ cellData }) =>
classnames(classes.default, {
[classes.low]: cellData < 20,
[classes.mediumLow]: cellData > 20 && cellData <= 40,
[classes.medium]: cellData > 40 && cellData <= 60,
[classes.mediumHigh]: cellData > 60 && cellData <= 80,
[classes.high]: cellData > 80
})
const columnsWithClasses = tableColumns.map(column => ({
...column,
className: getClasses
}))
//...more code
<BaseTable
//...more props
columns={columnsWithClasses}
data={dataExample}
className={classes.table}
/> |
Or you can use it this way: <BaseTable>
<Column key className />
</BaseTable> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd like to change de cell style according to its value. I tried to customize the TableCell component, but it didn't change the whole cell as you can see in the picture below.
Instead, I'd like to obtain the result like in the next image, but I don't know how to access each cell
Suggestion
If this feature doesn't exist, maybe create a new prop for override
.BaseTable__row-cell
CSS class could be an option like the example below.The text was updated successfully, but these errors were encountered: