DocsComponentsNavigation
Tabs
React example follows below.
ts
import { Tabs, type TabItem } from "@grassroot/ui-react"; const tabs: TabItem[] = [ { value: "overview", label: "Overview", content: "Service is healthy." }, { value: "logs", label: "Logs", content: "09:14 INFO deploy ok" },]; <Tabs tabs={tabs} defaultValue="overview" />ts
<script setup lang="ts">import { Tabs } from "@grassroot/ui-vue"; const tabs: TabItem[] = [ { value: "overview", label: "Overview", content: "Service is healthy." }, { value: "logs", label: "Logs", content: "09:14 INFO deploy ok" },];</script> <template> <Tabs :tabs="tabs" default-value="overview" /></template>ts
import { Component } from "@angular/core";import { GrassrootTabs } from "@grassroot/ui-angular"; @Component({ selector: "app-example", standalone: true, imports: [GrassrootTabs], template: ` <grassroot-tabs [tabs]="tabs" defaultValue="overview" /> `,})export class ExampleComponent { readonly tabs: TabItem[] = [ { value: "overview", label: "Overview", content: "Service is healthy." }, { value: "logs", label: "Logs", content: "09:14 INFO deploy ok" }, ];}ts
<script lang="ts"> import { Tabs } from "@grassroot/ui-svelte"; const tabs: TabItem[] = [ { value: "overview", label: "Overview", content: "Service is healthy." }, { value: "logs", label: "Logs", content: "09:14 INFO deploy ok" }, ];</script> <Tabs tabs={tabs} defaultValue="overview" />ts
import { Tabs } from "@grassroot/ui-solid"; const tabs: TabItem[] = [ { value: "overview", label: "Overview", content: "Service is healthy." }, { value: "logs", label: "Logs", content: "09:14 INFO deploy ok" },]; export function Example() { return ( <> <Tabs tabs={tabs} defaultValue="overview" /> </> );}Installation
bash
pnpm dlx grassroot add ui/tabsbash
npx grassroot@latest add ui/tabsbash
yarn dlx grassroot add ui/tabsbash
bunx grassroot add ui/tabsAPI Reference
| Prop | Type | Default |
|---|---|---|
tabsrequired | TabItem<string>[] | — |
value | string | undefined | — |
defaultValue | string | undefined | — |
onValueChange | ((value: string) => void) | undefined | — |
className | string | undefined | — |
id | string | undefined | — |