Skip to main content

Tabs

A component providing a navigation mechanism to allow users to switch between different sections or views of an application.

Code Example

import { TabBar, TabBarItem } from "@coconut-xr/apfel-kruemel";
import { Text } from "@coconut-xr/koestlich";
import { BoxSelect } from "@coconut-xr/lucide-koestlich";

export default function TabBar() {
return (
<TabBar defaultValue={1}>
<TabBarItem value={1} icon={<BoxSelect />}>
<Text>Label</Text>
</TabBarItem>
<TabBarItem value={2} icon={<BoxSelect />}>
<Text>Label</Text>
</TabBarItem>
<TabBarItem value={3} icon={<BoxSelect />}>
<Text>Label</Text>
</TabBarItem>
<TabBarItem value={4} icon={<BoxSelect />}>
<Text>Label</Text>
</TabBarItem>
</TabBar>
);
}

Sandbox

Params

Tab Bar
NameTypeAttributesDescription
valueToptionalThe current selected tab of the tab bar
defaultValueToptionalThe default selected tab of the tab bar
onValueChange(value: T) => voidoptionalCallback fired when the value is changed
Tab Bar Item
NameTypeAttributesDescription
valueToptionalThe value of the tab bar item
iconReactNodeoptionalAn icon displayed at the front of the tab bar item