Base

  • Colors
  • Icons
  • Logos
  • Shadows and Elevations
  • Spacing
  • Typography

Components

  • Accordion
  • Avatars
  • Badges
  • Buttons
  • Cards
  • Character Counter
  • Device Type Icons
  • Draggables
  • Dropdowns
  • Droppables
  • Expandable image
  • Filters
  • Gallery card
  • Icon Button
  • Indicators
  • Lightbox image
  • Lists
  • Loading
  • Messages
  • Pictogram
  • Poster Play
  • Progress bar
  • QR Code
  • Rating stars
  • Row Selector
  • Segmented Controls
  • Sentiment
  • Split View
  • Tables
  • Tags
  • Tester vitals
  • Toggle button
  • Typeahead

Form

  • Card Select
  • Checkbox
  • Combobox
  • Form Rule
  • Hint
  • Input
  • Input Title
  • Label
  • Multi-select List
  • Search
  • Select
  • Single-select List
  • Sliders
  • Switch
  • Text Area

Layout

  • Containers
  • Layers
  • Layout
  • Split Layout
  • Wrappers

Navigation

  • Context Switcher
  • Nav bar
  • Navigation
  • Pagination
  • Sidebar Navigation
  • Step Navigation
  • Tabs

Overlay

  • Banners
  • Bulk Selector
  • Modals
  • Popovers
  • Toast
  • Tooltips
  • User Notifications

Patterns

  • Full Page Message
  • Question card & Group Questions Container

Visualizations

  • Data Colors

Tabs

Tabs are used as a form of navigation within the same context, allowing the user to alternate between views that provide different information. A count badge can also be used in a tab.

Tabs

Copy
<tk-tabs-container>
<tk-tabs>
<tk-tab-button tab-selected="yourFunction()" tab-title="Gringotts" badge-type="light" badge-text="75"></tk-tab-button>
<tk-tab-button tab-title="The Leaky Cauldron"></tk-tab-button>
<tk-tab-button tab-title="Disabled Tab" disabled></tk-tab-button>
<tk-tab-divider></tk-tab-divider>
<tk-tab-link is-active tab-title="Flourish & Blotts" url="/navigation/tabs/#tabs0"></tk-tab-link>
</tk-tabs>
</tk-tabs-container>

Description

Tab children can either be <tk-tab-button> or <tk-tab-link>. Most likely, you’ll want to use the button.

Tabs with left aligned Icons

Copy
<tk-tabs-container>
<tk-tabs>
<tk-tab-button tab-selected="yourFunction()" tab-title="Gringotts" badge-type="light" badge-text="75">
<tk-icon name="home"/>
</tk-tab-button>
<tk-tab-button tab-title="The Leaky Cauldron">
<tk-icon name="calendar"/>
</tk-tab-button>
<tk-tab-button tab-title="Disabled Tab" disabled>
<tk-icon name="bell"/>
</tk-tab-button>
<tk-tab-divider></tk-tab-divider>
<tk-tab-link is-active tab-title="Flourish & Blotts" url="/navigation/tabs/#tabswithleftalignedicons1">
<tk-icon name="click"/>
</tk-tab-link>
<tk-tab-link tab-title="Ollivanders" url="/navigation/tabs/#tabswithleftalignedicons1">
<tk-icon name="star"/>
</tk-tab-link>
</tk-tabs>
</tk-tabs-container>

Description

Icon position (icon-position) can either be left or right and is available with both <tk-tab-button> or <tk-tab-link>.

Tabs with right aligned Icons

Copy
<tk-tabs-container>
<tk-tabs>
<tk-tab-button icon-position="right" tab-selected="yourFunction()" tab-title="Gringotts" badge-type="light" badge-text="75">
<tk-icon name="home"/>
</tk-tab-button>
<tk-tab-button icon-position="right" tab-title="The Leaky Cauldron">
<tk-icon name="calendar"/>
</tk-tab-button>
<tk-tab-button icon-position="right" tab-title="Disabled Tab" disabled>
<tk-icon name="bell"/>
</tk-tab-button>
<tk-tab-divider></tk-tab-divider>
<tk-tab-link icon-position="right" is-active tab-title="Flourish & Blotts" url="/navigation/tabs/#tabswithleftalignedicons1">
<tk-icon name="click"/>
</tk-tab-link>
<tk-tab-link icon-position="right" tab-title="Ollivanders" url="/navigation/tabs/#tabswithleftalignedicons1">
<tk-icon name="star"/>
</tk-tab-link>
</tk-tabs>
</tk-tabs-container>

Description

Icon position (icon-position) can either be left or right and is available with both <tk-tab-button> or <tk-tab-link>.

Vertical Tabs

subheader second subheader
Copy
<tk-tabs-container>
<tk-tabs vertical="true">
<tk-tab-subheader>subheader</tk-tab-subheader>
<tk-tab-button tab-selected="yourFunction()" tab-title="Gringotts" badge-type="light" badge-text="75">
<tk-icon name="home"/>
</tk-tab-button>
<tk-tab-button tab-title="The Leaky Cauldron1">
</tk-tab-button>
<tk-tab-divider vertical></tk-tab-divider>
<tk-tab-subheader>second subheader</tk-tab-subheader>
<tk-tab-button tab-title="The Leaky Cauldron2"></tk-tab-button>
<tk-tab-button tab-title="Disabled Tab" disabled></tk-tab-button>
</tk-tabs>
</tk-tabs-container>

Description

Tab children can either be <tk-tab-button> or <tk-tab-link>. Most likely, you’ll want to use the button.
<tk-tab-subheader> is currently only for vertical tabs.

Vertical tabs: indicator position

Expand Copy
<tk-tabs-container>
<tk-tabs vertical indicator-position="start">
<tk-tab-button tab-selected="yourFunction()" tab-title="Gringotts" badge-type="light" badge-text="75">
<tk-icon name="home"/>
</tk-tab-button>
<tk-tab-button is-active="true" tab-title="The Leaky Cauldron"></tk-tab-button>
<tk-tab-button tab-title="Disabled Tab" disabled></tk-tab-button>
<tk-tab-link tab-title="Flourish & Blotts" url="/navigation/tabs/#verticaltabs:indicatorposition4"></tk-tab-link>
</tk-tabs>
</tk-tabs-container>

Description

This sets the position of the active indicator. By default it’s aligned at the end, use indicator-position="start" to align it at the start.

Position: Center or Right

Copy
<tk-tabs-container>
<tk-tabs position="center">
<tk-tab-button tab-title="Borgin & Burkes"></tk-tab-button>
<tk-tab-divider></tk-tab-divider>
<tk-tab-button tab-title="Honeydukes"></tk-tab-button>
</tk-tabs>
</tk-tabs-container>

Description

This sets the alignment of the tabs. The default is aligned to the left.

Fill container

Expand Copy
<tk-tabs-container>
<tk-tabs fill-container="true">
<tk-tab-button tab-selected="yourFunction()" tab-title="Gringotts" badge-type="light" badge-text="75"></tk-tab-button>
<tk-tab-button is-active="true" tab-title="The Leaky Cauldron"></tk-tab-button>
<tk-tab-button tab-title="Disabled Tab" disabled></tk-tab-button>
<tk-tab-link tab-title="Flourish & Blotts" url="/navigation/tabs/#fillcontainer6"></tk-tab-link>
</tk-tabs>
</tk-tabs-container>

Description

By default, options are as wide as their content. To have them grow to the width of their container, set fill-container.

SetTabActive method

Click to set Gringotts active Click to set The Leaky Cauldron active Click to set Borgin & Burkes active
Expand Copy
<tk-tabs-container>
<tk-tabs class="my-tabs">
<tk-tab-button tab-title="Gringotts" is-active="true"></tk-tab-button>
<tk-tab-button tab-title="The Leaky Cauldron"></tk-tab-button>
<tk-tab-button tab-title="Borgin & Burkes"></tk-tab-button>
</tk-tabs>
</tk-tabs-container>
<tk-button class="l-block mt-3x" onClick="tabs.setTabActive('Gringotts')">
Click to set Gringotts active
</tk-button>
<tk-button class="l-block mt-3x" onClick="tabs.setTabActive('The Leaky Cauldron')">
Click to set The Leaky Cauldron active
</tk-button>
<tk-button class="l-block mt-3x" onClick="tabs.setTabActive('Borgin & Burkes')">
Click to set Borgin & Burkes active
</tk-button>

<script>
  const tabs = document.querySelector('tk-tabs.my-tabs');
</script>

Description

With a reference to the tk-tabs component it is possible to programmatically set a tab as active. This can be done by calling the setTabActive method on the tk-tabs component. The method takes the tab title to be set as active as an argument.

Usage

Do

  • Ensure there is always one active tab

Don't

  • Add a background behind the tab
  • Change the tab color or border

Accessibility

  • Receives :focus

  • aria-selected should be true when in focus and false when not