Link Tabs

I have these different Label's , when I come from other page to this page how can I make other labels active based on what the user clicked on the previous page?
9 Replies
Electronic
Electronic2y ago
Depends on how your is rendered what are u using... Views? React? Next.js? Vanilla? You would do that with a class but how to achieve it
Aldrin
Aldrin2y ago
Vanilla
Electronic
Electronic2y ago
That means your hard coding your navbar into every page You would just use a class
Aldrin
Aldrin2y ago
yes
MarkBoots
MarkBoots2y ago
you can read the url with window.location.href and based on that add an active class to the matching label
Aldrin
Aldrin2y ago
ok let me try
b1mind
b1mind2y ago
[aria-current="page"] {style me daddy} Don't use a class use aria-current attribute & selector and double down on awesome
b1mind
b1mind2y ago
Ben Myers
Style with Stateful, Semantic Selectors
See how building with accessible semantics from the get-go can give you expressive, meaningful style hooks for free.
Myndi
Myndi2y ago
{style me daddy}
worrySus