Tab groups organise content into a container that shows one section at a time.
This component makes use of tabs and tab panels. Each tab must be slotted into the navigation slot and its panel must refer to a tab panel of the same name.
<pc-tab-group><pc-tabslot="navigation"panel="general">General</pc-tab><pc-tabslot="navigation"panel="custom">Custom</pc-tab><pc-tabslot="navigation"panel="advanced">Advanced</pc-tab><pc-tabslot="navigation"panel="disabled"disabled> Disabled</pc-tab><pc-tab-panelname="general"> This is the general tab panel.</pc-tab-panel><pc-tab-panelname="custom"> This is the custom tab panel.</pc-tab-panel><pc-tab-panelname="advanced"> This is the advanced tab panel.</pc-tab-panel><pc-tab-panelname="disabled"> This is a disabled tab panel.</pc-tab-panel></pc-tab-group>
CodeEdit
Demos
Tabs on bottom
Tabs can be shown on the bottom by setting the placement attribute to bottom.
<pc-tab-groupplacement="bottom"><pc-tabslot="navigation"panel="general">General</pc-tab><pc-tabslot="navigation"panel="custom">Custom</pc-tab><pc-tabslot="navigation"panel="advanced">Advanced</pc-tab><pc-tabslot="navigation"panel="disabled"disabled> Disabled</pc-tab><pc-tab-panelname="general"> This is the general tab panel.</pc-tab-panel><pc-tab-panelname="custom"> This is the custom tab panel.</pc-tab-panel><pc-tab-panelname="advanced"> This is the advanced tab panel.</pc-tab-panel><pc-tab-panelname="disabled"> This is a disabled tab panel.</pc-tab-panel></pc-tab-group>
CodeEdit
Tabs on start
Tabs can be shown on the starting side by setting the placement attribute to start.
<pc-tab-groupplacement="start"><pc-tabslot="navigation"panel="general">General</pc-tab><pc-tabslot="navigation"panel="custom">Custom</pc-tab><pc-tabslot="navigation"panel="advanced">Advanced</pc-tab><pc-tabslot="navigation"panel="disabled"disabled> Disabled</pc-tab><pc-tab-panelname="general"> This is the general tab panel.</pc-tab-panel><pc-tab-panelname="custom"> This is the custom tab panel.</pc-tab-panel><pc-tab-panelname="advanced"> This is the advanced tab panel.</pc-tab-panel><pc-tab-panelname="disabled"> This is a disabled tab panel.</pc-tab-panel></pc-tab-group>
CodeEdit
Tabs on end
Tabs can be shown on the ending side by setting the placement attribute to end.
<pc-tab-groupplacement="end"><pc-tabslot="navigation"panel="general">General</pc-tab><pc-tabslot="navigation"panel="custom">Custom</pc-tab><pc-tabslot="navigation"panel="advanced">Advanced</pc-tab><pc-tabslot="navigation"panel="disabled"disabled> Disabled</pc-tab><pc-tab-panelname="general"> This is the general tab panel.</pc-tab-panel><pc-tab-panelname="custom"> This is the custom tab panel.</pc-tab-panel><pc-tab-panelname="advanced"> This is the advanced tab panel.</pc-tab-panel><pc-tab-panelname="disabled"> This is a disabled tab panel.</pc-tab-panel></pc-tab-group>
CodeEdit
Closable tabs
Add the closable attribute to a tab to add a close button.
<pc-tab-groupclass="tabs-closable"><pc-tabslot="navigation"panel="general">General</pc-tab><pc-tabslot="navigation"panel="closable-1"closable> Closable 1</pc-tab><pc-tabslot="navigation"panel="closable-2"closable> Closable 2</pc-tab><pc-tabslot="navigation"panel="closable-3"closable> Closable 3</pc-tab><pc-tab-panelname="general"> This is the general tab panel.</pc-tab-panel><pc-tab-panelname="closable-1"> This is the first closable tab panel.</pc-tab-panel><pc-tab-panelname="closable-2"> This is the second closable tab panel.</pc-tab-panel><pc-tab-panelname="closable-3"> This is the third closable tab panel.</pc-tab-panel></pc-tab-group>
CodeEdit
Scrolling tabs
When there are more tabs than horizontal space allows, the tab navigation bar will be scrollable.
<pc-tab-group><pc-tabslot="navigation"panel="tab-1">Tab 1</pc-tab><pc-tabslot="navigation"panel="tab-2">Tab 2</pc-tab><pc-tabslot="navigation"panel="tab-3">Tab 3</pc-tab><pc-tabslot="navigation"panel="tab-4">Tab 4</pc-tab><pc-tabslot="navigation"panel="tab-5">Tab 5</pc-tab><pc-tabslot="navigation"panel="tab-6">Tab 6</pc-tab><pc-tabslot="navigation"panel="tab-7">Tab 7</pc-tab><pc-tabslot="navigation"panel="tab-8">Tab 8</pc-tab><pc-tabslot="navigation"panel="tab-9">Tab 9</pc-tab><pc-tabslot="navigation"panel="tab-10">Tab 10</pc-tab><pc-tabslot="navigation"panel="tab-11">Tab 11</pc-tab><pc-tabslot="navigation"panel="tab-12">Tab 12</pc-tab><pc-tabslot="navigation"panel="tab-13">Tab 13</pc-tab><pc-tabslot="navigation"panel="tab-14">Tab 14</pc-tab><pc-tabslot="navigation"panel="tab-15">Tab 15</pc-tab><pc-tabslot="navigation"panel="tab-16">Tab 16</pc-tab><pc-tabslot="navigation"panel="tab-17">Tab 17</pc-tab><pc-tabslot="navigation"panel="tab-18">Tab 18</pc-tab><pc-tabslot="navigation"panel="tab-19">Tab 19</pc-tab><pc-tabslot="navigation"panel="tab-20">Tab 20</pc-tab><pc-tab-panelname="tab-1">This is the first tab panel.</pc-tab-panel><pc-tab-panelname="tab-2">This is the second tab panel.</pc-tab-panel><pc-tab-panelname="tab-3">This is the third tab panel.</pc-tab-panel><pc-tab-panelname="tab-4">This is the fourth tab panel.</pc-tab-panel><pc-tab-panelname="tab-5">This is the fifth tab panel.</pc-tab-panel><pc-tab-panelname="tab-6">This is the sixth tab panel.</pc-tab-panel><pc-tab-panelname="tab-7">This is the seventh tab panel.</pc-tab-panel><pc-tab-panelname="tab-8">This is the eighth tab panel.</pc-tab-panel><pc-tab-panelname="tab-9">This is the ninth tab panel.</pc-tab-panel><pc-tab-panelname="tab-10">This is the 10th tab panel.</pc-tab-panel><pc-tab-panelname="tab-11">This is the 11th tab panel.</pc-tab-panel><pc-tab-panelname="tab-12">This is the 12th tab panel.</pc-tab-panel><pc-tab-panelname="tab-13">This is the 13th tab panel.</pc-tab-panel><pc-tab-panelname="tab-14">This is the 14th tab panel.</pc-tab-panel><pc-tab-panelname="tab-15">This is the 15th tab panel.</pc-tab-panel><pc-tab-panelname="tab-16">This is the 16th tab panel.</pc-tab-panel><pc-tab-panelname="tab-17">This is the 17th tab panel.</pc-tab-panel><pc-tab-panelname="tab-18">This is the 18th tab panel.</pc-tab-panel><pc-tab-panelname="tab-19">This is the 19th tab panel.</pc-tab-panel><pc-tab-panelname="tab-20">This is the 20th tab panel.</pc-tab-panel></pc-tab-group>
CodeEdit
Fixed scroll controls
When tabs are scrolled all the way to one side, the scroll button on that side isn’t visible. Set the fixed-scroll-controls to always show both scroll buttons.
<pc-tab-groupfixed-scroll-controls><pc-tabslot="navigation"panel="tab-1">Tab 1</pc-tab><pc-tabslot="navigation"panel="tab-2">Tab 2</pc-tab><pc-tabslot="navigation"panel="tab-3">Tab 3</pc-tab><pc-tabslot="navigation"panel="tab-4">Tab 4</pc-tab><pc-tabslot="navigation"panel="tab-5">Tab 5</pc-tab><pc-tabslot="navigation"panel="tab-6">Tab 6</pc-tab><pc-tabslot="navigation"panel="tab-7">Tab 7</pc-tab><pc-tabslot="navigation"panel="tab-8">Tab 8</pc-tab><pc-tabslot="navigation"panel="tab-9">Tab 9</pc-tab><pc-tabslot="navigation"panel="tab-10">Tab 10</pc-tab><pc-tabslot="navigation"panel="tab-11">Tab 11</pc-tab><pc-tabslot="navigation"panel="tab-12">Tab 12</pc-tab><pc-tabslot="navigation"panel="tab-13">Tab 13</pc-tab><pc-tabslot="navigation"panel="tab-14">Tab 14</pc-tab><pc-tabslot="navigation"panel="tab-15">Tab 15</pc-tab><pc-tabslot="navigation"panel="tab-16">Tab 16</pc-tab><pc-tabslot="navigation"panel="tab-17">Tab 17</pc-tab><pc-tabslot="navigation"panel="tab-18">Tab 18</pc-tab><pc-tabslot="navigation"panel="tab-19">Tab 19</pc-tab><pc-tabslot="navigation"panel="tab-20">Tab 20</pc-tab><pc-tab-panelname="tab-1">This is the first tab panel.</pc-tab-panel><pc-tab-panelname="tab-2">This is the second tab panel.</pc-tab-panel><pc-tab-panelname="tab-3">This is the third tab panel.</pc-tab-panel><pc-tab-panelname="tab-4">This is the fourth tab panel.</pc-tab-panel><pc-tab-panelname="tab-5">This is the fifth tab panel.</pc-tab-panel><pc-tab-panelname="tab-6">This is the sixth tab panel.</pc-tab-panel><pc-tab-panelname="tab-7">This is the seventh tab panel.</pc-tab-panel><pc-tab-panelname="tab-8">This is the eighth tab panel.</pc-tab-panel><pc-tab-panelname="tab-9">This is the ninth tab panel.</pc-tab-panel><pc-tab-panelname="tab-10">This is the 10th tab panel.</pc-tab-panel><pc-tab-panelname="tab-11">This is the 11th tab panel.</pc-tab-panel><pc-tab-panelname="tab-12">This is the 12th tab panel.</pc-tab-panel><pc-tab-panelname="tab-13">This is the 13th tab panel.</pc-tab-panel><pc-tab-panelname="tab-14">This is the 14th tab panel.</pc-tab-panel><pc-tab-panelname="tab-15">This is the 15th tab panel.</pc-tab-panel><pc-tab-panelname="tab-16">This is the 16th tab panel.</pc-tab-panel><pc-tab-panelname="tab-17">This is the 17th tab panel.</pc-tab-panel><pc-tab-panelname="tab-18">This is the 18th tab panel.</pc-tab-panel><pc-tab-panelname="tab-19">This is the 19th tab panel.</pc-tab-panel><pc-tab-panelname="tab-20">This is the 20th tab panel.</pc-tab-panel></pc-tab-group>
CodeEdit
Manual activation
When focused, keyboard users can press ← and → to select the desired tab. By default, the corresponding tab panel will be shown immediately (automatic activation). You can change this behaviour by setting activation="manual" which will require the user to press Space or Enter before showing the tab panel (manual activation).
<pc-tab-groupactivation="manual"><pc-tabslot="navigation"panel="general">General</pc-tab><pc-tabslot="navigation"panel="custom">Custom</pc-tab><pc-tabslot="navigation"panel="advanced">Advanced</pc-tab><pc-tabslot="navigation"panel="disabled"disabled> Disabled</pc-tab><pc-tab-panelname="general"> This is the general tab panel.</pc-tab-panel><pc-tab-panelname="custom"> This is the custom tab panel.</pc-tab-panel><pc-tab-panelname="advanced"> This is the advanced tab panel.</pc-tab-panel><pc-tab-panelname="disabled"> This is a disabled tab panel.</pc-tab-panel></pc-tab-group>
CodeEdit
Properties
Name
Description
Reflects
Default
placement
The placement of the tabs. Type: "top" | "bottom" | "start" | "end"
"top"
activation
When this is set to auto, navigating the tabs with the arrow keys will instantly show the corresponding tab panel. If this is set to manual, the tab will receive focus but will not show the corresponding tab panel until the user presses Space or Enter/Return. Type: "auto" | "manual"
"auto"
syncKey sync-key
When set, the active tab will be persisted in localStorage and synced with other tab groups using the same key. Type: string | undefined
‐
noScrollControls no-scroll-controls
Hides the scroll buttons when tabs overflow. Type: boolean
false
fixedScrollControls fixed-scroll-controls
Prevents the scroll buttons from being hidden when it isn’t needed. Type: boolean
false
updateComplete
A read‐only promise that resolves when the component has finished updating.
If you’re using the autoloader or the standard loader, you can skip this section. But if you’re cherry picking, you can use any of the following snippets to import this component.
CDN (script tag)CDN (import)npm (import)
To manually import this component from the CDN, copy this code snippet and paste it in your HTML.
Whoa! You’ve wandered into the dangerous lands of Placer Toolkit. Version 0 is out of date and doesn’t meet EU privacy standards, including GDPR.
Want the latest powers, security and compliance? Stick with the current version of Placer Toolkit!
Yikes!Power up!
Our site is 100 % cookie‐free! We value your privacy, which is why we don’t store any cookies or personal information related to you.
Your browser history is safe from crumbs, and your data is protected, aligning with modern privacy standards like the GDPR. Enjoy your visit without a single digital cookie in sight! 🍪🚫