Skip to content

Applying styles to multiple Selects #5384

Answered by manjushsh
markoleptic asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @markoleptic,
If I am understanding correctly, you want to color hover background for both select differently but want to keep common style object.
You can append identifiable string and make conditional styling accordingly.

Code Sandbox. See last 2 selects

Code:

import { useState } from "react";
import Select from "react-select";

const ProfileCharts = ({ options }) => {
  const [selected, setSelected] = useState(null);

  const handleChange = (selectedOption) => {
    setSelected(selectedOption);
  };

  return (
    <>
      <Select
        className="game-mode-select"
        id="game-mode-select"
        options={options.map((option) => {
          return { ...option, value: `game…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@markoleptic
Comment options

@markoleptic
Comment options

Answer selected by markoleptic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants