0

I am new to SPFX and office-ui-fabric-react. I have a dropdownlist with below code and attributes:

<Stack tokens={stackTokens}>
     <Dropdown placeholder="Select an option" label="Select a name" options={this.state.items} styles={dropdownStyles} />
</Stack>

And here is the dropdownStyles:

const dropdownStyles: Partial<IDropdownStyles> = {
  dropdown: { width: 800 },
};

The official document is quite complex for me. Could you show me how to change the background color of selected dropdownlist item?

0

1 Answer 1

4

Try using something like:

const dropdownStyles: Partial<IDropdownStyles> = {
   dropdownItemSelected: { backgroundColor: "red" },
};
1
  • 1
    oh I was so close. I forgot to wrap the color name with quotation mark. Thank you
    – Mark L
    Jul 24, 2020 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.