material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Change color of check icons

Open Takesuma opened this issue 6 years ago • 1 comments

Change color of check icons

Excepted I excepted icons in boolean type to change color

To Reproduce TableIcons.js

...
Check: forwardRef((props, ref) => (
    <Check style={{ color: "#008000" }} {...props} ref={ref} />
  )),
...

index.js

...
    <MaterialTable
        data={data}
        columns={columns}
        title="Starter Template"
        icons={tableIcons}
      />
...

image Here the icons before the table are colored but not in the table

StackBlitz https://stackblitz.com/edit/material-table-starter-template-c2mqgj?file=index.js

Takesuma avatar Nov 30 '20 15:11 Takesuma

Try this: const columns = [ { title: "Id", field: "id" }, { title: "Word", field: "word" }, { title: "Boolean", field: "boolean", type: "boolean",
cellStyle: (e, rowData) => { if (!rowData.boolean) { return { color: "red" }; } else return {color: "green"} }, } ];

image

credits should go to: https://stackoverflow.com/questions/59150774/how-to-conditionally-style-reactjs-material-table-cell-based-on-cell-values

Samurus avatar Dec 01 '20 08:12 Samurus