need help in highlighting an div when it clicked
hey folks this is my jsx
and here is the css
now I want that when one of the div is clicked the color of text change for the clicked div like in the attached photo
2 Replies
no clue how that works in JSX, but you'll have to add a class to the currently active button. Are those navigation links, or filters? In another templating system, I'd add a conditional class comparing the application state (so either the active filter or the currently active route) to the value for that link, and if true, add an
active
class
then in css you can have .pluginButtons.active { color: white; }
https://benmyers.dev/blog/semantic-selectors/ SideNote: you can use
aria-current="page"
then style with a attribute selector and have a active class for free.