Material-ui: Can鈥檛 use IconComponent to set a custom icon for TableSortLabel Components.

Created on 12 Aug 2019  路  4Comments  路  Source: mui-org/material-ui

  • [ ] The issue is present in the latest release.
  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 馃槸


Still get the default ArrowDownward icon
image

Expected Behavior 馃


Instead of rendering default ArrowDownward icon, I want it to render ArrowDropDown icon
image

Steps to Reproduce 馃暪

Steps:

  1. imported ArrowDropDown at the top of the file: import ArrowDropDown from '@material-ui/icons/ArrowDropDown';
  2. Passed in ArrowDropDown to IconComponent within the TableSortLabel component:
<TableSortLabel
  IconComponent={ArrowDropDown}
  active={ currentSort.field === (field.props.sortBy || field.props.source) }
  direction={currentSort.order === 'ASC' ? 'asc' : 'desc'}
  data-sort={field.props.sortBy || field.props.source}
  onClick={updateSort}
  classes={classes}
>
  1. run yarn start
    There is the Sandbox link: https://codesandbox.io/embed/create-react-app-oupku

    Context 馃敠


I am trying to change the default ArrowDownward icon by setting IconComponent to ArrowDropDown icon, but it doesn't work, I still get the default ArrowDownward icon in the Chrome

Your Environment 馃寧

| Tech | Version |
| ----------- | ------- |
| @material-ui/icons | v1.0.0 |
| Material-UI | v1.4.0 |
| React | v16.8.4 |
| Browser | Chrome |

incomplete

Most helpful comment

Material-UI | v1.4.0

This feature was only added in v3.0.0.

All 4 comments

Can you provide a minimal reproducible example please. Potentially a codesandbox

Material-UI | v1.4.0

This feature was only added in v3.0.0.

Can you provide a minimal reproducible example please. Potentially a codesandbox

Sorry I didn't take a closer look at the step.
There is the Sandbox link:
https://codesandbox.io/embed/create-react-app-oupku

We only provide (free) support for the last active version. You need to upgrade to v3.0.0 or more recent version.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TimoRuetten picture TimoRuetten  路  3Comments

zabojad picture zabojad  路  3Comments

finaiized picture finaiized  路  3Comments

revskill10 picture revskill10  路  3Comments

anthony-dandrea picture anthony-dandrea  路  3Comments