Documentation
Switch

Switch

The Switch component allows users to toggle between different views or options within a container. It supports highlights, hover effects, and icons, making it an interactive and visually appealing navigation element.

Usage

First of all, you need to import the Switch component from the kitchn package.

import { Switch } from "kitchn"

Default

Disabled

You can disable the dropdown's automatic width matching to its parent element using the disableMatchWidth prop.

With Icons

Props

NameTypeDefaultRequiredDescription
tabsArray<{ value: string; title: React.ReactNode; icon?: React.ReactNode }>[]YesAn array of tabs, each containing a value, title, and optionally an icon.
selectedstring""YesThe value of the currently selected tab.
setSelected(value: string) => voidnullYesFunction to update the selected tab value.
disabledbooleanfalseNoIf true, all tabs will be disabled, preventing user interaction.
highlightbooleantrueNoIf true, a highlight effect will be shown on hover.
hoverHeightRationumber1NoAdjusts the height of the hover highlight relative to the tab.
hoverWidthRationumber1NoAdjusts the width of the hover highlight relative to the tab.