Currently, I am working on a toggle bar element that is functioning correctly in terms of styling the toggled button. However, I would like to add more animation to enhance the user experience.
The concept is to have the active button slide to the newly selected button for visual appeal. This means incorporating a sliding animation into the current code.
I am facing difficulty in figuring out how exactly to implement this feature. It seems that simply adding background and styles to the active element will not suffice; a floating or sliding box may be necessary.
While I prefer not to have someone implement it for me, I could use some guidance on where to start. Should I work with pseudo-elements? How can I ensure that the white button background element stretches to the width of the word behind it?
Although this is primarily a CSS-related question, I am unsure of how to initiate the implementation process.
If anyone has any advice, tips, or can point me in the right direction on how to achieve this effect, I would greatly appreciate it! Cheers!
Feel free to check out what I've built so far in CodeSandbox