Skip to main content
3.0.1Next5.1.05.0.35.0.25.0.15.0.04.0.94.0.84.0.73.2.03.1.03.0.13.0.02.1.12.0.101.0.0
Version: 3.0.1

Tab

Tabs are a navigation tool which splits content into pages, allowing users to select which page they want to see. This can be useful, both to contain completely different parts of the UI, or to simply display different versions of a minor UI element.

Basic Usage

<triton-tab>
<triton-tab-item tab-title="Tab 1"> The content of tab 1 </triton-tab-item>
<triton-tab-item tab-title="Tab 2" active> The content of tab 2 </triton-tab-item>
<triton-tab-item tab-title="Tab 3" disabled> The content of tab 3 </triton-tab-item>
</triton-tab>
<TritonTab>
<TritonTabItem tab-title="Tab 1"> The content of tab 1 </TritonTabItem>
<TritonTabItem tab-title="Tab 2" active> The content of tab 2 </TritonTabItem>
<TritonTabItem tab-title="Tab 3" disabled> The content of tab 3 </TritonTabItem>
</TritonTab>
<html> 
<head>
<script type="module">
import { defineCustomElements } from '~node_modules/@kognifai/triton-cl-core/loader/index.es2017.js';
defineCustomElements();
</script>
</head>
<body>
<TritonTab>
<TritonTabItem tab-title="Tab 1"> The content of tab 1 </TritonTabItem>
<TritonTabItem tab-title="Tab 2" active> The content of tab 2 </TritonTabItem>
<TritonTabItem tab-title="Tab 3" disabled> The content of tab 3 </TritonTabItem>
</TritonTab>
</body>
</html>
The content of tab 1 The content of tab 2 The content of tab 3

Variants

The default tab is horizontal, as seen in the basic example.

Vertical Tabs

Tabs can also be set up to fall vertically, as opposed to their default horizontal orientation. To achieve this, set the orientation property to vertical.

The content of tab 1The content of tab 2The content of tab 3
<triton-tab orientation="vertical">
<triton-tab-item tab-title="Tab 1">The content of tab 1</triton-tab-item>
<triton-tab-item tab-title="Tab 2">The content of tab 2</triton-tab-item>
<triton-tab-item tab-title="Tab 3">The content of tab 3</triton-tab-item>
</triton-tab>

Behavior

To use the tab component as a menu, pass in the component without any content. The router implementation depends on your framework. For Angular, use the RouterModule and apply routerLinkActive and routerLink on the TritonTabItem element. With routerLinkActive set to active, the component will trigger the correct state on the selected tab item.

The content of tab 1The content of tab 2The content of tab 3The content of tab 4
<triton-tab>
<triton-tab-item tab-title="Orders" icon-leading="broadcast">The content of tab 1</triton-tab-item>
<triton-tab-item tab-title="Details" icon-leading="box" active>The content of tab 2</triton-tab-item>
<triton-tab-item tab-title="Report" icon-leading="chat-buble">The content of tab 3</triton-tab-item>
<triton-tab-item tab-title="Critical" icon-leading="cancel">The content of tab 4</triton-tab-item>
</triton-tab>

Appearance

Fluid Width

By setting the fluid property to true, you can force the TritonTab to fill the full width of its container.

The content of tab 1The content of tab 2The content of tab 3
<triton-tab fluid="true">
<triton-tab-item tab-title="Tab 1">The content of tab 1</triton-tab-item>
<triton-tab-item tab-title="Tab 2">The content of tab 2</triton-tab-item>
<triton-tab-item tab-title="Tab 3">The content of tab 3</triton-tab-item>
</triton-tab>

Size

The following sizes are available in the Triton Design System.

small size tab 1small size tab 2small size tab 3small size tab 4small size tab 5small size tab 6base size tab 1base size tab 2base size tab 3base size tab 4base size tab 5base size tab 6
<triton-tab size="small">
<triton-tab-item tab-title="Tab 1">small size tab 1</triton-tab-item>
...
</triton-tab>

<triton-tab size="base">
<triton-tab-item tab-title="Tab 1">base size tab 1</triton-tab-item>
...
</triton-tab>

Playground

API

Properties

triton-tab

PropertyDescriptionTypeDefault
fluidIf true, the element fills all available widthbooleanfalse
orientationSet the orientation of the tabs. If set to vertical the tabs will group downwardsNote The fluid property is not compatible with vertical orientationhorizontal vertical'horizontal'
sizeSet the size of the componentbase body large medium small tiny xlarge xxlarge xxxlarge'base'

triton-tab-item

PropertyDescriptionTypeDefault
activeThe tab that is currently openbooleanfalse
disabledIf true, the component will look disabled and not be interactableboolean-
fluidIf true, the element fills as much width as it canboolean-
icon-leadingIcon displayed on the left of the tabs titleIcon-
icon-trailingIcon displayed on the right of the tabs titleIcon-
notification-countDisplay number of new notifications on the tabnumber-
sizeSet the size of the tab in the tab barbase body large medium small tiny xlarge xxlarge xxxlargedefaultOptions.baseSize
tab-titleThe title to be displayed on the tabstring-

Slots

Main

can only be a TritonTabItem, any other element will be ignored

<triton-tab>
<div></div>
</triton-tab>