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

307
Visualizações
Change Selected Item Background Color of Semantic UI Form.Select element

I have semantic UI React imported as follows

import { Form } from 'semantic-ui-react'

Now, I am using their Select Component as follows:

<Form>
  <Form.Group widths="equal">
    <Form.Select //I wish to change the background color of only the selected item
      placeholder={"Choose Item"}
      value={selectedItem}
      className={classes.select}
      onChange={handleItemSelectionChange}
      options={
        items.map((e) => {
          return (
            {
              key: e['name'],
              value: e['name'],
              text: e['name']
            }
          )
        })
      }
    >
    </Form.Select>
  </Form.Group>
</Form>

How can I change the background color and icon color of only the selected item in the Form.Select component.

Thank you.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I did not see any built-in option in their API, but you can achieve this using css, the parent div of the selected option has a class of 'selection' by default, and the option div has a class of 'divider' by default, so you can add something like this in you css -

.selection.dropdown > .divider {
  background-color: red;
}

 .selection.dropdown > .divider:before {
    content: "";
    display: block;
    background: url("icon.jpg") no-repeat;
    width: 20px;
    height: 20px;
    float: left;
    margin: 0 6px 0 0;
}

also you should check out the react.semantic-ui dropdown component which has more options then the select component which is just a wrapper around it.

about 4 years ago · Juan Pablo Isaza 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