Command palette

@yasinsensoy/native

React Native · Components

Tabs

Switches between views in the same area.

4 exports

Live example

The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.

Preview

General settings go here.

Code

import { Tabs, Genel, Badge, Bildirimler, G } from "@yasinsensoy/native";

<Tabs defaultValue="Genel"
  items={[
    { value: "Genel", label: "Genel", icon: "settings", tooltip: "Open General settings", content: <Genel /> },
    { value: "Bildirimler", label: "Bildirimler", icon: "mail", badge: <Badge size="sm">3</Badge>, tooltip: "Open Notifications settings", content: <Bildirimler /> },
    { value: "Güvenlik", label: "Güvenlik", icon: "user", disabled: true, tooltip: "You don't have permission for this tab", content: <Güvenlik /> },
  ]}
/>

Events

  1. Events appear here when you interact with the preview.

Import

import { Tabs } from "@yasinsensoy/native";

Tabs

component

Switches between views in the same area. If the tabs do not fit, the list scrolls horizontally and the selected tab is brought into view; in the line style the underline slides to the selected tab on the native driver. Previously opened panels stay in the tree (their state is kept).

Tabs({ ref, items, value: valueProp, defaultValue, onValueChange, orientation, variant: variantProp, effect, fullWidth, label, style, }: TabsProps): JSX.Element

Examples

<Tabs items={[
  { value: "general", label: "General", content: <General /> },
  { value: "security", label: "Security", icon: "lock", content: <Security /> },
]} />

TabItem

interface

A tab inside Tabs.

NameTypeDescription
valuestringUnique value.
labelReactNodeTab text.
icon?IconPropIcon before the text.
badge?ReactNodeSmall content after the text (e.g. <Badge>3</Badge>).
content?ReactNodePanel shown while the tab is selected.
disabled?booleanCannot be selected.

Tab style: pill a pill on a muted background, line an underline.

type TabsVariant = "pill" | "line"

TabsProps

interface

Tabs props.

NameTypeDefaultDescription
ref?Ref<ViewRef>Ref of the underlying native element.
itemsreadonly TabItem[]Tabs.
value?stringSelected tab (controlled).
defaultValue?stringthe first enabled tabInitially selected tab.
onValueChange?(value: string) => voidWhen the selection changes.
orientation?"horizontal" | "vertical""horizontal"Tab layout.
variant?TabsVariant | (string & {})"pill"Style: one of the built-in styles or a name added via appearance.variants.tabs (applied to the tab list).
effect?EffectPropEffect of the tabs ("ripple", "glow"…); stays on for the selected tab like active. Defaults to appearance.defaults.tabs.effect. See BuiltinEffect.
fullWidth?booleanTabs share the row equally (no scrolling).
label?stringScreen reader name of the tab list.
style?StyleProp<ViewStyle>Container style.