p-tabs-bar component is a styled button/link list for multiple purposes. You can use it with your framework router
to ensure your window location updates on tab click, use it for hash routing and displaying content accordingly
to the hash, as skip navigation to move on a longer page or to change the state of another element and therefore
change the appearance of your content .update with the index of
the active tab.Important note
<button> tags in the examples below to make them clickable without changing the route.
For route changes it is mandatory to use <a> tags with href in your application. And be aware of that it's not allowed to mix and match <button> with <a> tags as direct children in the component!<button> tags if you need to
change e.g. the state on tab-click or <a> tags, if you also have to manipulate the window location, inside the
<p-tabs-bar> component and it will handle all styling behaviors.update event
which is emitted by p-tabs-bar.<!doctype html>
<html lang="en" class="scheme-light-dark">
<head>
<title></title>
</head>
<body class="bg-canvas">
<p-tabs-bar>
<button type="button">
Tab One
</button>
<button type="button">
Tab Two
</button>
<button type="button">
Tab Three
</button>
</p-tabs-bar>
<script>
const pTabsBar = document.querySelector("p-tabs-bar");
pTabsBar.addEventListener('update', (e) => e.target.activeTabIndex = e.detail.activeTabIndex);
</script>
</body>
</html>