Atoms / Tabs

Tabs

Views of one page; arrows, Home and End move between them.

import { Tabs } from "@forgeron/ui";
/01 → Default
Overview of the tool.
import { Tabs } from "@forgeron/ui";
import { useState } from "react";

const tabs = [
  { id: "overview", label: "Overview" },
  { id: "activity", label: "Activity" },
  { id: "settings", label: "Settings" },
];

export default function Default() {
  const [tab, setTab] = useState("overview");
  return (
    <div style={{ width: "100%", maxWidth: 520 }}>
      <Tabs label="Tool" tabs={tabs} value={tab} onChange={setTab}>
        {tabs.find((t) => t.id === tab)?.label} of the tool.
      </Tabs>
    </div>
  );
}
API → Props
PropTypeDefaultDescription
labelstring—Names the tab list.
tabs{ id, label }[]—The tabs.
valuestring—The selected id.
onChange(id: string) => void—On a new tab.
childrenReactNode—The panel of the selected tab.
classNamestring—Extra classes.