SnowballSH Foundation UI

Tabs

Pick a framework. Both use the same recipe, so the styling matches exactly.

The write panel. Arrow keys move between tabs.

Tabs props for React
PropTypeDefaultDescription
items{ value: string; label: string }[]One entry per tab.
valuestringThe active tab. In Svelte it is bindable with bind:value.
onValueChange(value: string) => voidCalled when the active tab changes.
childrencontentPanel content for the active tab.

Also takes className and children. Anything else passes through to the div.

tabs.demo.tsx
import { useState } from "react";
import { Tabs } from "../react/index.js";

const items = [
  { value: "write", label: "Write" },
  { value: "preview", label: "Preview" },
  { value: "publish", label: "Publish" },
];

export default function TabsDemo() {
  const [value, setValue] = useState("write");
  return (
    <Tabs items={items} value={value} onValueChange={setValue}>
      <p className="text-ink-secondary">
        The <span className="font-medium text-ink">{value}</span> panel. Arrow
        keys move between tabs.
      </p>
    </Tabs>
  );
}