Components
Tab

Tab

The Tab component is used to create individual tabs within a tabbed interface. It provides options for customizing the tab's label, icon, and appearance.

Props

NameTypeDefaultDescription
labelstring | JSX.Element | React.ReactNode | React.ReactElementThe label of the tab. You can use a string, a JSX element, or a React node.
iconstring | JSX.Element | React.ReactNode | React.ReactElementAn optional icon to display before the label. You can use a string, a JSX element, or a React node.
suffixIconstring | JSX.Element | React.ReactNode | React.ReactElementAn optional icon to display after the label. You can use a string, a JSX element, or a React node.
prefixReactElementAn optional element to display before the tab's content.
suffixReactElementAn optional element to display after the tab's content.
activebooleanfalseWhether the tab is currently active or not.
disabledbooleanfalseIf true, the tab is disabled and cannot be clicked.
onClick() => voidA callback function to execute when the tab is clicked.

Try It

import { Tab } from '@kloktun/uikit'
import SearchIcon from './search-icon.tsx'

export default function TabExample() {
    return (
        <div className="flex flex-row">
            <Tab label="Tab 1" active />
            <Tab label="Tab 2" />
            <Tab label="Tab 3" icon={<SearchIcon/>} />
            <Tab label="Tab 4" suffixIcon={<SearchIcon/>} disabled />
            <Tab label="Tab 5" disabled />
        </div>
    );
}