Navigation
RouteTabs
Tabs that are links, one page for each tab, so a tab can open in a new browser tab. The current tab has aria-current="page". Below 768 px the tabs that fit stay in the row, the current one always among them, and the others go into “More”. The tabs take the full width of their parent. In a flex row, give the other items shrink-0.
import { RouteTabs, type RouteTab } from "@percentsa/ui";Examples
Code
export function RouteTabsExample() {
const t = useT();
const tabs = [
["overview", "Overview", "نظرة عامة"],
["deployments", "Deployments", "عمليات النشر"],
["logs", "Logs", "السجلات"],
["metrics", "Metrics", "المقاييس"],
["environment", "Environment variables", "متغيرات البيئة"],
["access", "Access", "الوصول"],
["settings", "Settings", "الإعدادات"],
] as const;
return (
<div className="w-full max-w-2xl">
<RouteTabs
label={t("App sections", "أقسام التطبيق")}
current="environment"
items={tabs.map(([value, en, ar]) => ({ value, label: t(en, ar), href: `#${value}`, count: value === "deployments" ? 12 : undefined }))}
/>
</div>
);
}