Docs Components Navigation

Tabs

React example follows below.
ts
const tabsFixture = {
id: "tabs",
defaultValue: "overview",
tabs: [
{ value: "overview", label: "Overview", content: "Deployment health is stable." },
{ value: "history", label: "History", content: "Six releases shipped this month." },
{ value: "settings", label: "Settings", content: "Notification settings are locked.", disabled: true },
],
} satisfies {
id: string;
defaultValue: string;
tabs: Array<{ value: string; label: string; content: string; disabled?: boolean }>;
};
import { Tabs } from "@grassroot/ui-react";
export default function TabsDemo() {
return (
<div>
<Tabs {...tabsFixture} />
</div>
);
}
ts
<script setup lang="ts">
import { Tabs } from "@grassroot/ui-vue";
const tabsFixture = {
id: "tabs",
defaultValue: "overview",
tabs: [
{ value: "overview", label: "Overview", content: "Deployment health is stable." },
{ value: "history", label: "History", content: "Six releases shipped this month." },
{ value: "settings", label: "Settings", content: "Notification settings are locked.", disabled: true },
],
} satisfies {
id: string;
defaultValue: string;
tabs: Array<{ value: string; label: string; content: string; disabled?: boolean }>;
};
</script>
<template>
<div>
<Tabs :tabs="tabsFixture.tabs" :default-value="tabsFixture.defaultValue" />
</div>
</template>
ts
import { Component } from "@angular/core";
import { GrassrootTabs } from "@grassroot/ui-angular";
const tabsFixture = {
id: "tabs",
defaultValue: "overview",
tabs: [
{ value: "overview", label: "Overview", content: "Deployment health is stable." },
{ value: "history", label: "History", content: "Six releases shipped this month." },
{ value: "settings", label: "Settings", content: "Notification settings are locked.", disabled: true },
],
} satisfies {
id: string;
defaultValue: string;
tabs: Array<{ value: string; label: string; content: string; disabled?: boolean }>;
};
@Component({
selector: "app-tabs-demo",
standalone: true,
imports: [GrassrootTabs],
template: `
<div>
<grassroot-tabs [tabs]="tabs" [value]="fixture.defaultValue" />
</div>
`,
})
export class TabsDemoComponent {
protected readonly fixture = tabsFixture;
protected readonly tabs = [...tabsFixture.tabs];
}
export default TabsDemoComponent;
ts
<script lang="ts">
import { Tabs } from "@grassroot/ui-svelte";
const tabsFixture = {
id: "tabs",
defaultValue: "overview",
tabs: [
{ value: "overview", label: "Overview", content: "Deployment health is stable." },
{ value: "history", label: "History", content: "Six releases shipped this month." },
{ value: "settings", label: "Settings", content: "Notification settings are locked.", disabled: true },
],
} satisfies {
id: string;
defaultValue: string;
tabs: Array<{ value: string; label: string; content: string; disabled?: boolean }>;
};
</script>
<div>
<Tabs tabs={tabsFixture.tabs} defaultValue={tabsFixture.defaultValue} />
</div>
ts
/** @jsxImportSource solid-js */
import { Tabs } from "@grassroot/ui-solid";
const tabsFixture = {
id: "tabs",
defaultValue: "overview",
tabs: [
{ value: "overview", label: "Overview", content: "Deployment health is stable." },
{ value: "history", label: "History", content: "Six releases shipped this month." },
{ value: "settings", label: "Settings", content: "Notification settings are locked.", disabled: true },
],
} satisfies {
id: string;
defaultValue: string;
tabs: Array<{ value: string; label: string; content: string; disabled?: boolean }>;
};
export default function TabsDemo() {
return (
<div>
<Tabs tabs={tabsFixture.tabs} defaultValue={tabsFixture.defaultValue} />
</div>
);
}

Installation

API Reference

Import

import { Tabs } from "@grassroot/ui-react";

Props

Prop
Type
Default
Requirement
tabs
TabItem<string>[]
required
value
string | undefined
optional
defaultValue
string | undefined
optional
onValueChange
((value: string) => void) | undefined
optional
className
string | undefined
optional
id
string | undefined
optional
Prop
tabs
Type
TabItem<string>[]
Default
Requirement
required
Prop
value
Type
string | undefined
Default
Requirement
optional
Prop
defaultValue
Type
string | undefined
Default
Requirement
optional
Prop
onValueChange
Type
((value: string) => void) | undefined
Default
Requirement
optional
Prop
className
Type
string | undefined
Default
Requirement
optional
Prop
id
Type
string | undefined
Default
Requirement
optional

Events

EventPayload
onValueChange((value: string) => void) | undefined

Import

import { Tabs } from "@grassroot/ui-vue";

Props

Prop
Type
Default
Requirement
tabs
TabItem[]
required
modelValue
string | undefined
optional
defaultValue
string | undefined
optional
id
string | undefined
optional
Prop
tabs
Type
TabItem[]
Default
Requirement
required
Prop
modelValue
Type
string | undefined
Default
Requirement
optional
Prop
defaultValue
Type
string | undefined
Default
Requirement
optional
Prop
id
Type
string | undefined
Default
Requirement
optional

Events

EventPayload
update:modelValue[value: string]

Content regions

  • panel
  • tab

Import

import { Component } from "@angular/core";
import { GrassrootTabs } from "@grassroot/ui-angular";

Props

Prop
Type
Default
Requirement
tabs
readonly TabItem[]
required
id
string
"grassroot-tabs"
optional
value
string
optional
Prop
tabs
Type
readonly TabItem[]
Default
Requirement
required
Prop
id
Type
string
Default
"grassroot-tabs"
Requirement
optional
Prop
value
Type
string
Default
Requirement
optional

Events

EventPayload
valueChangestring

Import

import { Tabs } from "@grassroot/ui-svelte";

Props

Prop
Type
Default
Requirement
tabs
TabItem[]
required
value
string
optional
defaultValue
string
optional
id
string
optional
onValueChange
(value: string) => void
optional
className
string
optional
Prop
tabs
Type
TabItem[]
Default
Requirement
required
Prop
value
Type
string
Default
Requirement
optional
Prop
defaultValue
Type
string
Default
Requirement
optional
Prop
id
Type
string
Default
Requirement
optional
Prop
onValueChange
Type
(value: string) => void
Default
Requirement
optional
Prop
className
Type
string
Default
Requirement
optional

Events

EventPayload
onValueChange(value: string) => void

Content regions

  • panel
  • tab

Import

import { Tabs } from "@grassroot/ui-solid";

Props

Prop
Type
Default
Requirement
tabs
TabItem[]
required
value
string
optional
defaultValue
string
optional
onValueChange
(value: string) => void
optional
className
string
optional
id
string
optional
Prop
tabs
Type
TabItem[]
Default
Requirement
required
Prop
value
Type
string
Default
Requirement
optional
Prop
defaultValue
Type
string
Default
Requirement
optional
Prop
onValueChange
Type
(value: string) => void
Default
Requirement
optional
Prop
className
Type
string
Default
Requirement
optional
Prop
id
Type
string
Default
Requirement
optional

Events

EventPayload
onValueChange(value: string) => void