Return to Sky UI homepage
import { Tabs } from '@sky-uk/ui-core';

Props

PropTypeDefaultDescription
$appearancestringdefault

The $appearance prop sets tab styles for various backgrounds, including a light version for dark backgrounds. It's responsive, allowing breakpoint-specific adjustments.

'default' | 'light'

$fillbooleanfalse

Dictates whether the Tabs proportionately fill the available space. This prop is responsive and can be used to set the $fill value at different breakpoints.

idstring

The id attribute assigns the relevant ARIA attributes to establish a semantic relationship between the Tab and its corresponding Panel.

onTabClick(index: number) => void

The onTabClick callback triggers when a tab is clicked, providing the index of the clicked tab as a number. This enables custom actions based on the specific tab interaction.

Tabs.Tab

PropTypeDefaultDescription
$activebooleanIndicates the current tab selection.
$hoverbooleanIndicates if a tab is being hovered over.
$themestring

The theme of the active indicator as a Sky gradient
Note: if $appearance is set to light, the theme will be ignored.

Basic Tabs

Tabs Props

$appearance

$appearance can be set to light or default to provide contrast with backgrounds.

$fill

Set $fill to have Tabs proportionately take up the available space

id

The id attribute sets the appropriate aria attributes to provide semantic relationship between the Tab and Panel.

<Tabs id="example-4">

The id is essential for the Tabs to function correctly and must be a unique value when multiple Tabs are used on a page.

OnTabClick

The onTabClick callback is triggered when a tab is clicked. It receives the index of the clicked tab as a number. This allows you to determine which tab was activated and perform additional actions or updates based on the selected tab.

Tabs.Tab Props

$active

Add $active to indicate current selection on the initial render.

Note: You can only have one tab with the $active prop. If no tab has the $active prop, the first tab will be set as active by default.

$theme

Set $theme on an individual Tab to use any predefined gradient.

Note: Takes Precedence over Tabs $appearance

States

The hover and focus state can be set via $hover and $focused respectively to override default behavior.

Tabs with Icons

You can enhance the Tabs component by including Icon for a more visual representation.

Note: Ensure $size is implemented in accordance with guidance.

System Modifiers

The Tabs component supports the props applied using the following system modifiers:

The Tabs.Panel component supports the props applied using the following system modifiers: