TransWikia.com

How to change dropdownItem color in office-ui-fabric-react?

SharePoint Asked on December 26, 2021

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?

One Answer

Try using something like:

const dropdownStyles: Partial<IDropdownStyles> = {
   dropdownItemSelected: { backgroundColor: "red" },
};

Answered by Ganesh Sanap on December 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP