Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(web): page tabs draw their own divider (#18548)

Trang Nguyen7e3c0e316c91
diff --git a/web/src/components/design-system/Tabs/Tabs.tsx b/web/src/components/design-system/Tabs/Tabs.tsx
index 7093783ba2..6495eb8164 100644
--- a/web/src/components/design-system/Tabs/Tabs.tsx
+++ b/web/src/components/design-system/Tabs/Tabs.tsx
@@ -16,8 +16,6 @@ import { cn } from "@/src/utils/tailwind";
type TabsVariant = "inset" | "underline";
type TabsInsetSize = "sm" | "md";
-/** `navigation` is the underline look for link tabs: the page header owns the divider. */
-type TabsLook = TabsVariant | "navigation";
const rootFillClassName =
"flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden";
@@ -34,7 +32,6 @@ const tabsListVariants = cva(
inset:
"bg-control-track/60 dark:bg-muted text-foreground-tertiary relative isolate justify-center rounded-md p-0.5",
underline: "h-9 shrink-0 justify-start border-b",
- navigation: "h-9 shrink-0 justify-start",
},
size: {
sm: "",
@@ -56,7 +53,7 @@ const tabsListVariants = cva(
{ look: "inset", size: "md", class: "h-7" },
{ look: "inset", layout: ["default", "packed"], class: "inline-flex" },
{
- look: ["underline", "navigation"],
+ look: "underline",
layout: ["default", "packed"],
class: "flex w-full",
},
@@ -77,8 +74,6 @@ const tabsTriggerVariants = cva(
"relative z-1 min-w-0 rounded-sm dark:data-[state=active]:text-primary",
underline:
"text-muted-foreground data-[state=active]:border-foreground-secondary rounded-none border-b-2 border-transparent bg-transparent px-4 text-sm",
- navigation:
- "text-muted-foreground data-[state=active]:border-foreground-secondary rounded-none border-b-2 border-transparent bg-transparent px-3 text-sm",
},
size: {
sm: "px-2 text-xs",
@@ -152,7 +147,7 @@ type TabsListProps = {
);
const TabsListContext = React.createContext<{
- look: TabsLook;
+ look: TabsVariant;
size?: TabsInsetSize;
} | null>(null);
@@ -167,8 +162,7 @@ function TabsList({
variant,
}: TabsListProps) {
const inRoot = React.use(TabsRootContext) !== null;
- const look: TabsLook =
- variant === "underline" && !inRoot ? "navigation" : variant;
+ const look = variant;
const listRef = React.useRef<HTMLDivElement>(null);
const indicatorRef = React.useRef<HTMLSpanElement>(null);
const hasSlidingIndicator = look === "inset";
@@ -266,10 +260,13 @@ function TabsList({
const className = tabsListVariants({ gap, layout, look, size });
- if (look === "navigation") {
+ if (!inRoot) {
return (
<TabsListContext value={{ look }}>
- <nav aria-label={ariaLabel} className={className}>
+ <nav
+ aria-label={ariaLabel}
+ className={cn(className, "w-max min-w-full")}
+ >
{children}
</nav>
</TabsListContext>
diff --git a/web/src/components/design-system/table/Table.tsx b/web/src/components/design-system/table/Table.tsx
index e3f6e78c02..7fd47f43f5 100644
--- a/web/src/components/design-system/table/Table.tsx
+++ b/web/src/components/design-system/table/Table.tsx
@@ -48,6 +48,8 @@ export interface TableProps<TData> {
columnOrder?: ColumnOrderState;
onColumnOrderChange?: OnChangeFn<ColumnOrderState>;
rowHeight?: "s" | "m" | "l";
+ /** `false` for a table that sits directly under a divider, such as page tabs. */
+ topBorder?: boolean;
}
export function Table<TData extends object>({
@@ -66,6 +68,7 @@ export function Table<TData extends object>({
columnOrder,
onColumnOrderChange,
rowHeight,
+ topBorder = true,
}: TableProps<TData>) {
const tableColumns = useMemo<ColumnDef<TData>[]>(() => {
if (!actions) return columns;
@@ -146,7 +149,12 @@ export function Table<TData extends object>({
return (
<div className="flex w-full max-w-full flex-1 flex-col overflow-auto">
- <div className="relative min-h-full w-full overflow-auto border-t [scrollbar-gutter:stable]">
+ <div
+ className={cn(
+ "relative min-h-full w-full overflow-auto [scrollbar-gutter:stable]",
+ topBorder && "border-t",
+ )}
+ >
<table
aria-label={tableName}
className="w-full table-fixed border-separate border-spacing-0 space-y-4 overflow-auto text-sm"
diff --git a/web/src/components/layouts/mobile-page-title.tsx b/web/src/components/layouts/mobile-page-title.tsx
index bfbe9363e9..82f408b6e2 100644
--- a/web/src/components/layouts/mobile-page-title.tsx
+++ b/web/src/components/layouts/mobile-page-title.tsx
@@ -13,6 +13,7 @@ import {
TooltipProvider,
TooltipTrigger,
} from "@/src/components/ui/tooltip";
+import { cn } from "@/src/utils/tailwind";
import { MoreHorizontal } from "lucide-react";
import { useRef, useState } from "react";
@@ -64,7 +65,12 @@ export const MobilePageTitle = ({
);
return (
- <div className="bg-background border-b px-3 pt-2 pb-3">
+ <div
+ className={cn(
+ "bg-background px-3 pt-2",
+ tabsProps ? "pb-0" : "border-b pb-3",
+ )}
+ >
{/* Context line: org / project switcher plus any page-supplied
breadcrumb items (detail pages rely on these for back-navigation). */}
<div className="flex items-center gap-2">
@@ -188,7 +194,10 @@ export const MobilePageTitle = ({
<PageHeaderControlsSlotTarget />
</div>
- {tabsProps && <PageTabs {...tabsProps} scrollable className="mt-2" />}
+ {/** The strip bleeds through the block padding so its divider spans the full width. */}
+ {tabsProps && (
+ <PageTabs {...tabsProps} scrollable className="-mx-3 mt-2" />
+ )}
</div>
);
};
diff --git a/web/src/components/layouts/page-header.tsx b/web/src/components/layouts/page-header.tsx
index 687ce724cf..bb7b38b861 100644
--- a/web/src/components/layouts/page-header.tsx
+++ b/web/src/components/layouts/page-header.tsx
@@ -52,7 +52,8 @@ export type PageHeaderProps = {
tabsProps?: PageTabsProps;
className?: string;
/** Bottom border and bottom padding; pages whose own strip follows the
- * header directly turn both off so title and strip read as one block. */
+ * header directly turn both off so title and strip read as one block.
+ * Page tabs draw their own divider, so the border is skipped when they render. */
divider?: boolean;
showSidebarTrigger?: boolean;
leadingControl?: ReactNode;
@@ -90,7 +91,7 @@ const PageHeader = ({
<div
className={cn([
"top-banner-offset bg-background sticky z-30 w-full",
- divider && "border-b",
+ divider && !tabsProps && "border-b",
className,
])}
id="page-header"
diff --git a/web/src/components/layouts/page-tabs.tsx b/web/src/components/layouts/page-tabs.tsx
index 9103de6bae..b790352dc6 100644
--- a/web/src/components/layouts/page-tabs.tsx
+++ b/web/src/components/layouts/page-tabs.tsx
@@ -1,4 +1,4 @@
-/* eslint-disable @repo/no-style-props, @repo/no-margin-on-root-elements */
+/* eslint-disable @repo/no-style-props */
import { Tabs } from "@/src/components/design-system/Tabs/Tabs";
import { cn } from "@/src/utils/tailwind";
import { useRouter } from "next/router";
@@ -35,7 +35,7 @@ export const PageTabs = ({
}: PageTabsProps) => {
const router = useRouter();
return (
- <div className={cn(scrollable && "-mx-1 overflow-x-auto px-1", className)}>
+ <div className={cn(scrollable && "overflow-x-auto", className)}>
<Tabs.List variant="underline">
{tabs.map((tab) => (
<Tabs.Trigger
diff --git a/web/src/features/dashboard/DashboardsPage.tsx b/web/src/features/dashboard/DashboardsPage.tsx
index 055f4edfdb..e03b4a243b 100644
--- a/web/src/features/dashboard/DashboardsPage.tsx
+++ b/web/src/features/dashboard/DashboardsPage.tsx
@@ -17,7 +17,6 @@ export default function DashboardsPage() {
return (
<Page
headerProps={{
- className: "border-b-0",
title: "Dashboards",
help: {
description: "Manage and create dashboards for your project.",
diff --git a/web/src/features/dashboard/components/DashboardTable/ConnectedDashboardTable.tsx b/web/src/features/dashboard/components/DashboardTable/ConnectedDashboardTable.tsx
index e2c2ab047e..a9cecc3a27 100644
--- a/web/src/features/dashboard/components/DashboardTable/ConnectedDashboardTable.tsx
+++ b/web/src/features/dashboard/components/DashboardTable/ConnectedDashboardTable.tsx
@@ -174,6 +174,7 @@ export function ConnectedDashboardTable() {
<div className="flex min-h-0 flex-1 flex-col">
<DashboardTable
projectId={projectId}
+ topBorder={false}
hasAccess={hasAccess}
loadingRowCount={Math.min(paginationState.pageSize, 8)}
onEdit={(dashboard) => {
diff --git a/web/src/features/dashboard/components/DashboardTable/DashboardTable.tsx b/web/src/features/dashboard/components/DashboardTable/DashboardTable.tsx
index 7fb03d34e2..4806f394da 100644
--- a/web/src/features/dashboard/components/DashboardTable/DashboardTable.tsx
+++ b/web/src/features/dashboard/components/DashboardTable/DashboardTable.tsx
@@ -35,6 +35,7 @@ export function DashboardTable({
| "onRowClick"
| "orderBy"
| "setOrderBy"
+ | "topBorder"
> & {
hasAccess: boolean;
onClone: (dashboard: DashboardTableRow) => void;
diff --git a/web/src/features/widgets/WidgetsPage.tsx b/web/src/features/widgets/WidgetsPage.tsx
index f39d47c2f9..bbb1b143a3 100644
--- a/web/src/features/widgets/WidgetsPage.tsx
+++ b/web/src/features/widgets/WidgetsPage.tsx
@@ -17,7 +17,6 @@ export default function WidgetsPage() {
return (
<Page
headerProps={{
- className: "border-b-0",
title: "Widgets",
help: {
description: "Manage and create widgets for your dashboard.",
diff --git a/web/src/features/widgets/components/WidgetTable/ConnectedWidgetTable.tsx b/web/src/features/widgets/components/WidgetTable/ConnectedWidgetTable.tsx
index f407d427dc..04b7fac216 100644
--- a/web/src/features/widgets/components/WidgetTable/ConnectedWidgetTable.tsx
+++ b/web/src/features/widgets/components/WidgetTable/ConnectedWidgetTable.tsx
@@ -283,6 +283,7 @@ function ConnectedDashboardWidgetTableContent({
<div className="flex min-h-0 flex-1 flex-col">
<DashboardWidgetTable
projectId={projectId}
+ topBorder={false}
hasCUDAccess={hasCUDAccess}
loadingRowCount={Math.min(paginationState.pageSize, 8)}
onCopy={(widget) => handleCopyToClipboard(widget.id)}
diff --git a/web/src/features/widgets/components/WidgetTable/WidgetTable.tsx b/web/src/features/widgets/components/WidgetTable/WidgetTable.tsx
index 2cc770c869..c82b5736d4 100644
--- a/web/src/features/widgets/components/WidgetTable/WidgetTable.tsx
+++ b/web/src/features/widgets/components/WidgetTable/WidgetTable.tsx
@@ -87,6 +87,7 @@ export function DashboardWidgetTable({
| "onRowClick"
| "orderBy"
| "setOrderBy"
+ | "topBorder"
> & {
projectId: string | undefined;
hasCUDAccess: boolean;