Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

294
Visualizações
Is there a way I can combine two icons, one on top of the other, as the IconComponent in Table header using Material UI

I am trying to build a table where I have an up/down triangle icon next to the column instead of default up arrow after the column name to indicate sorting. I went through the material-ui docs and read that the IconComponent prop can be used to give an icon other than the default, but I couldn't find a way to combine two icons, one on top of the other, and pass them in as the IconComponent prop.

Table column showing the header text 'activity' with an up triangle icon and a down triangle icon stacked on top of each other

Here is what I have tried on CodeSandBox.

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

You can create a new component which is called Icon, which stacks the two icons using a flexbox container:

const Icon = () => {
  return (
    <span
      style={{
        display: "flex",
        flexDirection: "column",
        justifyContent: "Center",
        alignItems: "Center",
        marginLeft: "5px"
      }}
    >
      <KeyBoardUpIcon fontSize="12" />
      <KeyBoardDownIcon fontSize="12" />
    </span>
  );
};

And use it as IconComponent prop in TableSortLabels:

 <TableSortLabel
      active={true}
      direction={orderBy === headCell.id ? order : "asc"}
      IconComponent={Icon}
      onClick={createSortHandler(headCell.id)}
    >

Edit EnhancedTable Material Demo (forked)

about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda