Skip to content

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

feat(ui): more compact main menu (#10354)

Marc Klingenab0fa0bd76ab
diff --git a/web/src/components/nav/app-sidebar.tsx b/web/src/components/nav/app-sidebar.tsx
index c2d952eb86..63d1a21537 100644
--- a/web/src/components/nav/app-sidebar.tsx
+++ b/web/src/components/nav/app-sidebar.tsx
@@ -49,7 +49,7 @@ export function AppSidebar({
return (
<Sidebar collapsible="icon" variant="sidebar" {...props}>
<SidebarHeader>
- <div className="flex min-h-10 items-center gap-2 px-3 py-2">
+ <div className="flex min-h-10 items-center gap-2 px-2 py-2 group-data-[collapsible=icon]:p-3">
<LangfuseLogo version />
</div>
<div className="h-1 flex-1 border-b" />
@@ -87,7 +87,7 @@ const DemoBadge = () => {
return null;
return (
- <SidebarGroup className="mb-1 border-b">
+ <SidebarGroup className="border-b">
<SidebarGroupLabel>Demo Project (view only)</SidebarGroupLabel>
<SidebarGroupContent>
<SidebarMenu>
diff --git a/web/src/components/ui/sidebar.tsx b/web/src/components/ui/sidebar.tsx
index a969c21d83..fa811b9ddf 100644
--- a/web/src/components/ui/sidebar.tsx
+++ b/web/src/components/ui/sidebar.tsx
@@ -21,7 +21,7 @@ import {
import { Portal } from "@radix-ui/react-tooltip";
const SIDEBAR_STORAGE_KEY = "sidebar:state";
-const SIDEBAR_WIDTH = "13rem";
+const SIDEBAR_WIDTH = "11rem";
const SIDEBAR_WIDTH_MOBILE = "12rem";
const SIDEBAR_WIDTH_ICON = "3rem";
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
@@ -387,7 +387,11 @@ const SidebarFooter = React.forwardRef<
<div
ref={ref}
data-sidebar="footer"
- className={cn("flex flex-col gap-2 p-2", className)}
+ className={cn(
+ "flex flex-col gap-2",
+ "group-data-[collapsible=icon]:p-2",
+ className,
+ )}
{...props}
/>
);
@@ -402,7 +406,7 @@ const SidebarSeparator = React.forwardRef<
<Separator
ref={ref}
data-sidebar="separator"
- className={cn("mx-2 w-auto bg-sidebar-border", className)}
+ className={cn("w-auto bg-sidebar-border", className)}
{...props}
/>
);
@@ -435,7 +439,11 @@ const SidebarGroup = React.forwardRef<
<div
ref={ref}
data-sidebar="group"
- className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
+ className={cn(
+ "relative flex w-full min-w-0 flex-col px-1 py-1 first:pt-0",
+ "group-data-[collapsible=icon]:p-2 group-data-[collapsible=icon]:first:pt-2",
+ className,
+ )}
{...props}
/>
);
@@ -453,8 +461,9 @@ const SidebarGroupLabel = React.forwardRef<
ref={ref}
data-sidebar="group-label"
className={cn(
- "flex h-8 shrink-0 items-center whitespace-nowrap rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ "flex h-8 shrink-0 items-center whitespace-nowrap px-[9px] text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:hidden",
+ "-mb-2",
className,
)}
{...props}
@@ -474,7 +483,7 @@ const SidebarGroupAction = React.forwardRef<
ref={ref}
data-sidebar="group-action"
className={cn(
- "absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ "absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
// Increases the hit area of the button on mobile.
"after:absolute after:-inset-2 after:md:hidden",
"group-data-[collapsible=icon]:hidden",
@@ -506,7 +515,11 @@ const SidebarMenu = React.forwardRef<
<ul
ref={ref}
data-sidebar="menu"
- className={cn("flex w-full min-w-0 flex-col gap-1", className)}
+ className={cn(
+ "flex w-full min-w-0 flex-col gap-0.5 pt-1",
+ "group-data-[collapsible=icon]:gap-1 group-data-[collapsible=icon]:pt-0",
+ className,
+ )}
{...props}
/>
));
@@ -626,7 +639,7 @@ const SidebarMenuAction = React.forwardRef<
ref={ref}
data-sidebar="menu-action"
className={cn(
- "absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
+ "absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
// Increases the hit area of the button on mobile.
"after:absolute after:-inset-2 after:md:hidden",
"peer-data-[size=sm]/menu-button:top-1",
@@ -651,7 +664,7 @@ const SidebarMenuBadge = React.forwardRef<
ref={ref}
data-sidebar="menu-badge"
className={cn(
- "pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground",
+ "pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center px-1 text-xs font-medium tabular-nums text-sidebar-foreground",
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
"peer-data-[size=sm]/menu-button:top-1",
"peer-data-[size=default]/menu-button:top-1.5",
@@ -679,14 +692,11 @@ const SidebarMenuSkeleton = React.forwardRef<
<div
ref={ref}
data-sidebar="menu-skeleton"
- className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
+ className={cn("flex h-8 items-center gap-2 px-2", className)}
{...props}
>
{showIcon && (
- <Skeleton
- className="size-4 rounded-md"
- data-sidebar="menu-skeleton-icon"
- />
+ <Skeleton className="size-4" data-sidebar="menu-skeleton-icon" />
)}
<Skeleton
className="h-4 max-w-[--skeleton-width] flex-1"
@@ -710,7 +720,7 @@ const SidebarMenuSub = React.forwardRef<
ref={ref}
data-sidebar="menu-sub"
className={cn(
- "flex min-w-0 translate-x-px flex-col gap-1 border-sidebar-border py-0.5",
+ "flex min-w-0 translate-x-px flex-col border-sidebar-border py-0.5",
"group-data-[collapsible=icon]:hidden",
className,
)}
@@ -742,7 +752,7 @@ const SidebarMenuSubButton = React.forwardRef<
data-size={size}
data-active={isActive}
className={cn(
- "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
+ "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
size === "sm" && "text-xs",
size === "md" && "text-sm",