While working with a dropdown component from react-bootstrap
, I encountered a situation where I needed to change the font size of the context menu in just one specific component.
To achieve this, I decided to create a separate css
file named panel.css
and include it in my component using import './panel.css;
.
Within the panel.css
file, I targeted the Select-menu-outer
class and applied a custom font size like so:
.Select-menu-outer { font-size: 12px }
Although this solution worked as intended, the downside was that it affected the font size of all other dropdowns throughout the entire application.
I considered utilizing CSS Modules
by importing styles from panel.css
and assigning the className dynamically, but due to the third-party nature of the library component, I hesitated to implement this approach.
Do you have any suggestions for a more effective way to implement this customization?