Skip to content

πŸͺ’ Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(events): collapse the mobile traces toolbar into a Filters sheet (LFE-11067) (#15357)

Nikita Kabardin5875e4ce27b1
diff --git a/web/src/components/date-picker.tsx b/web/src/components/date-picker.tsx
index 3a0629df47..a1503d6485 100644
--- a/web/src/components/date-picker.tsx
+++ b/web/src/components/date-picker.tsx
@@ -311,6 +311,12 @@ export type TimeRangePickerProps = {
className?: string;
/** Extra classes for the trigger button (e.g. tighter padding in the header). */
triggerClassName?: string;
+ /**
+ * Space-tight variant (e.g. the mobile Filters sheet header): the named-range
+ * trigger drops the abbreviation badge and shows just the label, truncating
+ * instead of pushing the row wide. Custom/none branches are unchanged.
+ */
+ compact?: boolean;
disabled?: boolean | { before?: Date; after?: Date } | Date | Date[];
maxRangeMs?: number;
};
@@ -318,6 +324,7 @@ export type TimeRangePickerProps = {
export function TimeRangePicker({
className,
triggerClassName,
+ compact,
timeRange,
timeRangePresets,
onTimeRangeChange,
@@ -494,20 +501,41 @@ export function TimeRangePicker({
const getDisplayContent = () => {
if (rangeType === "custom") {
+ const customLabel = dateRange
+ ? formatDateRange(dateRange.from, dateRange.to)
+ : "Select from calendar";
+ // Compact: drop the icon and truncate, like the named branch β€” a custom
+ // range's long formatted string would otherwise overflow the tight
+ // mobile Filters header.
+ if (compact) {
+ return (
+ <span className="min-w-0 truncate" title={customLabel}>
+ {customLabel}
+ </span>
+ );
+ }
// Custom range - show calendar icon and date range
return (
<div className="flex items-center gap-2">
<CalendarIcon className="h-4 w-4" />
- <span>
- {dateRange
- ? formatDateRange(dateRange.from, dateRange.to)
- : "Select from calendar"}
- </span>
+ <span>{customLabel}</span>
</div>
);
} else if (rangeType === "named") {
// Preset range - show badge with abbreviation and label
const setting = TIME_RANGES[namedRangeValue as keyof typeof TIME_RANGES];
+ if (compact) {
+ // Compact: just the label, truncating. The abbreviation badge is the
+ // first thing to drop when the header is tight.
+ return (
+ <span
+ className="min-w-0 truncate"
+ title={setting?.label || namedRangeValue || undefined}
+ >
+ {setting?.label || namedRangeValue}
+ </span>
+ );
+ }
return (
<div className="flex items-center gap-2">
<span className="bg-muted h-5 w-10 rounded px-1.5 text-center text-xs leading-5">
@@ -518,6 +546,13 @@ export function TimeRangePicker({
);
}
// No time range selected
+ if (compact) {
+ return (
+ <span className="min-w-0 truncate" title="Select time range">
+ Select time range
+ </span>
+ );
+ }
return (
<div className="flex items-center gap-2">
<CalendarIcon className="h-4 w-4" />
@@ -535,12 +570,19 @@ export function TimeRangePicker({
className={cn(
"hover:bg-accent hover:text-accent-foreground w-fit justify-start text-left font-normal",
!timeRange && "text-muted-foreground",
+ // Let the trigger shrink below content so the label truncates in
+ // a tight header instead of widening the row.
+ compact && "min-w-0",
triggerClassName,
)}
>
- <div className="flex items-center gap-2">
+ <div
+ className={cn("flex items-center gap-2", compact && "min-w-0")}
+ >
{getDisplayContent()}
- <ChevronDown className="h-4 w-4 opacity-50" />
+ <ChevronDown
+ className={cn("h-4 w-4 opacity-50", compact && "shrink-0")}
+ />
</div>
</Button>
</PopoverTrigger>
diff --git a/web/src/components/table/data-table-controls.tsx b/web/src/components/table/data-table-controls.tsx
index 5ed9bd345a..47ce22c763 100644
--- a/web/src/components/table/data-table-controls.tsx
+++ b/web/src/components/table/data-table-controls.tsx
@@ -172,6 +172,14 @@ interface DataTableControlsProps {
* every filter live.
*/
blockedColumnReason?: (column: string) => string | null;
+ /**
+ * "panel" (default): a self-contained, full-height column with its own
+ * internal ScrollArea β€” the desktop filter sidebar.
+ * "inline": the facet list flows at NATURAL height with no internal scroll,
+ * so it can live inside a host's single outer scroll (the mobile Filters
+ * sheet). Follow-scroll still works β€” scrollIntoView bubbles to that host.
+ */
+ layout?: "panel" | "inline";
}
// Module-stable initial value: a fresh {} per render would re-subscribe
@@ -182,6 +190,7 @@ export function DataTableControls({
queryFilter,
filterWithAI,
blockedColumnReason,
+ layout = "panel",
}: DataTableControlsProps) {
const { isLangfuseCloud } = useLangfuseCloudRegion();
const { setOpen, tableName, isMobile } = useDataTableControls();
@@ -200,6 +209,9 @@ export function DataTableControls({
`${storagePrefix}-active-only`,
false,
);
+ // Local (not lifted to the provider): the render sites key DataTableControls
+ // by selectedViewId, so this transient "which facets are revealed" state
+ // resets on a saved-view switch by remount β€” the desired behavior.
const [revealedColumns, setRevealedColumns] = useState<string[]>([]);
// Selected filters on top: a facet is PROMOTED when it carries an active
@@ -544,6 +556,107 @@ export function DataTableControls({
return null;
};
+ // The facet list itself. Rendered inside a Radix ScrollArea (panel) or a
+ // plain natural-height div (inline) below β€” extracted so neither wrapper
+ // duplicates it.
+ const facetList = (
+ <div
+ className={cn(
+ // panel: w-0 + min-w-full pins content to the Radix viewport width
+ // (its inline `display: table; min-width: 100%` wrapper otherwise grows
+ // to CONTENT width, breaking label truncation). inline has no such
+ // viewport, so a plain w-full block is correct.
+ layout === "inline" ? "w-full" : "w-0 min-w-full",
+ "pt-1 pb-10",
+ )}
+ >
+ <Accordion
+ type="multiple"
+ className="w-full"
+ value={queryFilter.expanded}
+ onValueChange={queryFilter.onExpandedChange}
+ >
+ {/* ONE keyed child array β€” not two .map() slices: React can
+ only match keys within the same array, so a facet crossing
+ the promoted/rest boundary would REMOUNT (wiping input
+ focus and draft state) instead of moving. */}
+ {displayedFilters.flatMap((filter, index) => {
+ const nodes = [];
+ if (index === promotedFacetCount && promotedFacetCount > 0) {
+ // Clear spatial break between the active/added block and
+ // the inactive rest of the catalog.
+ nodes.push(
+ // The one line that means something: the boundary
+ // between the active/added block and the catalog.
+ <div
+ key="promoted-separator"
+ className="border-border mx-2 my-2 border-t"
+ aria-hidden
+ />,
+ );
+ }
+ nodes.push(renderFacet(filter));
+ return nodes;
+ })}
+ </Accordion>
+
+ {/* Active-only mode: surface the rest of the catalog behind an
+ explicit "Add filter" picker, most-recently-used first, so
+ the filters someone actually works with are one click away. */}
+ {showOnlyActive && (
+ <div
+ className={cn(
+ "px-3 pt-4",
+ displayedFilters.length === 0 &&
+ "flex flex-col items-center gap-1 pt-8 text-center",
+ )}
+ >
+ {displayedFilters.length === 0 && (
+ <p className="text-muted-foreground pb-2 text-xs">
+ No active filters.
+ </p>
+ )}
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ variant="outline"
+ size="sm"
+ className="text-xs"
+ disabled={addableFilters.length === 0}
+ >
+ <Plus className="mr-1.5 h-3.5 w-3.5" />
+ Add filter
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ align="start"
+ className="max-h-72 w-56 overflow-y-auto"
+ >
+ {addableFilters.map((filter) => {
+ // A column the surface can't honour stays visible but is
+ // not addable β€” adding it would only land a facet that
+ // immediately reads blocked (chart view β€” #15187 /
+ // #15049). Same reason on hover.
+ const reason = blockedColumnReason?.(filter.column) ?? null;
+ return (
+ <DropdownMenuItem
+ key={filter.column}
+ disabled={!!reason}
+ title={reason ?? undefined}
+ onClick={() => handleAddFilter(filter.column)}
+ className="cursor-pointer"
+ >
+ {filter.label}
+ </DropdownMenuItem>
+ );
+ })}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ )}
+ </div>
+ );
+
return (
<>
{/* Collapsed rail: shown when the sidebar is collapsed on desktop, where
@@ -618,16 +731,25 @@ export function DataTableControls({
</div>
<div
className={cn(
- "bg-background flex h-full w-full flex-col overflow-hidden border-t",
+ "bg-background flex w-full flex-col border-t",
+ // panel: a bounded, self-scrolling column. inline: natural height so
+ // the host's outer scroll owns scrolling (no clip, no forced height).
+ layout === "panel" && "h-full overflow-hidden",
"group-data-[expanded=false]/controls:hidden",
)}
>
<div className="bg-background flex h-10 shrink-0 items-center justify-between border-b px-3">
<div className="flex items-center gap-1.5">
- {isMobile ? (
- // No tooltip: the sheet auto-focuses this control on open, and a
- // Radix tooltip opens on focus β€” it would pop up unprompted. An X
- // is self-evident anyway.
+ {/* Three contexts for the header's close affordance:
+ - inline (events MobileFiltersSheet): the sheet owns its own X +
+ "Filters" title, so render neither here β€” a second X would
+ duplicate it and tapping it just dismisses the whole sheet.
+ - mobile panel (other tables' ResizableFilterLayout bottom
+ sheet): this panel IS the sheet, so its header X is the close.
+ No tooltip (the sheet auto-focuses it on open and a Radix
+ tooltip would pop up unprompted); an X is self-evident.
+ - desktop: collapse-to-rail via the Hide-filters button. */}
+ {layout === "inline" ? null : isMobile ? (
<Button
variant="ghost"
size="icon"
@@ -659,8 +781,12 @@ export function DataTableControls({
<TooltipContent>Hide filters</TooltipContent>
</Tooltip>
)}
- <span className="text-sm font-bold">Filters</span>
- {activeFilterCount > 0 && (
+ {layout !== "inline" && (
+ <span className="text-sm font-bold">Filters</span>
+ )}
+ {/* Inline: the count already shows on the sheet's Filters trigger
+ and footer, so a bare number here (title hidden) is just noise. */}
+ {layout !== "inline" && activeFilterCount > 0 && (
<Badge variant="secondary" className="h-5 px-1.5 text-xs">
{activeFilterCount}
</Badge>
@@ -777,8 +903,10 @@ export function DataTableControls({
Show only active
{showOnlyActive && <Check className="ml-auto h-3.5 w-3.5" />}
</DropdownMenuItem>
- {/* "Collapse sidebar" is desktop-rail chrome; in the mobile
- sheet the header's X already closes it. */}
+ {/* "Collapse sidebar" is desktop-rail chrome β€” there's no rail
+ on mobile (either sheet), where the header X / sheet footer
+ already close it. Covers both the other-tables mobile sheet
+ and the events inline sheet (inline is always mobile). */}
{!isMobile && (
<>
<DropdownMenuSeparator />
@@ -797,113 +925,36 @@ export function DataTableControls({
</DropdownMenu>
</div>
</div>
- <ScrollArea
- // contain:paint β€” during handle drags the browser (notably
- // Firefox) can leave stale fragments of the sticky headers
- // painted outside the shrinking panel; paint containment pins
- // every layer inside the scroll root.
- className="min-h-0 flex-1 [contain:paint]"
- ref={scrollRootRef}
- onFocusCapture={(event) => {
- lastFocusedRef.current = event.target as HTMLElement;
- }}
- >
- {/* w-0 + min-w-full pins the content to the viewport width: the
- Radix viewport wraps children in an inline-styled
- `display: table; min-width: 100%` div that otherwise grows to
- CONTENT width β€” long value labels would stop truncating and
- hover-revealed affordances would widen the whole list. width: 0
- zeroes the content's intrinsic contribution (the table stays at
- min-width: 100%), then min-w-full stretches this wrapper back to
- the now-fixed table width. */}
- <div className="w-0 min-w-full pt-1 pb-10">
- <Accordion
- type="multiple"
- className="w-full"
- value={queryFilter.expanded}
- onValueChange={queryFilter.onExpandedChange}
- >
- {/* ONE keyed child array β€” not two .map() slices: React can
- only match keys within the same array, so a facet crossing
- the promoted/rest boundary would REMOUNT (wiping input
- focus and draft state) instead of moving. */}
- {displayedFilters.flatMap((filter, index) => {
- const nodes = [];
- if (index === promotedFacetCount && promotedFacetCount > 0) {
- // Clear spatial break between the active/added block and
- // the inactive rest of the catalog.
- nodes.push(
- // The one line that means something: the boundary
- // between the active/added block and the catalog.
- <div
- key="promoted-separator"
- className="border-border mx-2 my-2 border-t"
- aria-hidden
- />,
- );
- }
- nodes.push(renderFacet(filter));
- return nodes;
- })}
- </Accordion>
-
- {/* Active-only mode: surface the rest of the catalog behind an
- explicit "Add filter" picker, most-recently-used first, so
- the filters someone actually works with are one click away. */}
- {showOnlyActive && (
- <div
- className={cn(
- "px-3 pt-4",
- displayedFilters.length === 0 &&
- "flex flex-col items-center gap-1 pt-8 text-center",
- )}
- >
- {displayedFilters.length === 0 && (
- <p className="text-muted-foreground pb-2 text-xs">
- No active filters.
- </p>
- )}
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button
- variant="outline"
- size="sm"
- className="text-xs"
- disabled={addableFilters.length === 0}
- >
- <Plus className="mr-1.5 h-3.5 w-3.5" />
- Add filter
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- align="start"
- className="max-h-72 w-56 overflow-y-auto"
- >
- {addableFilters.map((filter) => {
- // A column the surface can't honour stays visible but is
- // not addable β€” adding it would only land a facet that
- // immediately reads blocked (chart view β€” #15187 /
- // #15049). Same reason on hover.
- const reason =
- blockedColumnReason?.(filter.column) ?? null;
- return (
- <DropdownMenuItem
- key={filter.column}
- disabled={!!reason}
- title={reason ?? undefined}
- onClick={() => handleAddFilter(filter.column)}
- className="cursor-pointer"
- >
- {filter.label}
- </DropdownMenuItem>
- );
- })}
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- )}
+ {layout === "inline" ? (
+ // inline: no internal scroll β€” the facet list flows at natural
+ // height inside the host's outer scroll (the mobile Filters sheet).
+ // scrollRootRef stays attached so the follow-scroll scrollIntoView
+ // still resolves; it bubbles to the host scroller. contain:paint is
+ // kept for the same stale-fragment reason as the panel.
+ <div
+ className="[contain:paint]"
+ ref={scrollRootRef}
+ onFocusCapture={(event) => {
+ lastFocusedRef.current = event.target as HTMLElement;
+ }}
+ >
+ {facetList}
</div>
- </ScrollArea>
+ ) : (
+ <ScrollArea
+ // contain:paint β€” during handle drags the browser (notably
+ // Firefox) can leave stale fragments of the sticky headers
+ // painted outside the shrinking panel; paint containment pins
+ // every layer inside the scroll root.
+ className="min-h-0 flex-1 [contain:paint]"
+ ref={scrollRootRef}
+ onFocusCapture={(event) => {
+ lastFocusedRef.current = event.target as HTMLElement;
+ }}
+ >
+ {facetList}
+ </ScrollArea>
+ )}
</div>
</>
);
diff --git a/web/src/components/table/data-table-refresh-button.tsx b/web/src/components/table/data-table-refresh-button.tsx
index f22e0698d7..8c50c422b2 100644
--- a/web/src/components/table/data-table-refresh-button.tsx
+++ b/web/src/components/table/data-table-refresh-button.tsx
@@ -24,6 +24,13 @@ interface DataTableRefreshButtonProps {
isRefreshing: boolean;
interval: RefreshInterval;
setInterval: (interval: RefreshInterval) => void;
+ /**
+ * Space-tight variant (e.g. the mobile Filters sheet header): the split
+ * control drops the "Off" label when auto-refresh is disabled and gains an
+ * accent border (plus the interval label, e.g. "30s") once an interval is
+ * set. Default (non-compact) is unchanged.
+ */
+ compact?: boolean;
}
export function DataTableRefreshButton({
@@ -31,8 +38,11 @@ export function DataTableRefreshButton({
isRefreshing,
interval,
setInterval,
+ compact = false,
}: DataTableRefreshButtonProps) {
const activeInterval = REFRESH_INTERVALS.find((i) => i.value === interval);
+ // Only a real interval counts as active; null ("Off") is the resting state.
+ const isActive = interval != null;
return (
<div className="flex items-center">
@@ -41,7 +51,10 @@ export function DataTableRefreshButton({
size="icon"
onClick={onRefresh}
disabled={isRefreshing}
- className="rounded-r-none border-r-0"
+ className={cn(
+ "rounded-r-none border-r-0",
+ compact && isActive && "border-primary",
+ )}
title="Refresh"
>
<RefreshCw className={cn("h-4 w-4", isRefreshing && "animate-spin")} />
@@ -51,12 +64,22 @@ export function DataTableRefreshButton({
<Button
variant="outline"
size="icon"
- className="w-auto rounded-l-none border-l-0 px-2"
+ className={cn(
+ "w-auto rounded-l-none border-l-0 px-2",
+ compact && isActive && "border-primary text-primary",
+ )}
>
<ChevronDown className="h-4 w-4" />
- <span className="ml-1 text-sm">
- {activeInterval?.label ?? "Off"}
- </span>
+ {compact ? (
+ // Drop the "Off" label; surface the interval only when set.
+ isActive && (
+ <span className="ml-1 text-sm">{activeInterval?.label}</span>
+ )
+ ) : (
+ <span className="ml-1 text-sm">
+ {activeInterval?.label ?? "Off"}
+ </span>
+ )}
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
diff --git a/web/src/features/events/components/EventsTable.tsx b/web/src/features/events/components/EventsTable.tsx
index c7023e70cc..dc07d745f4 100644
--- a/web/src/features/events/components/EventsTable.tsx
+++ b/web/src/features/events/components/EventsTable.tsx
@@ -51,8 +51,13 @@ import { useTableDateRange } from "@/src/hooks/useTableDateRange";
import {
toAbsoluteTimeRange,
type TableDateRange,
+ TABLE_AGGREGATION_OPTIONS,
} from "@/src/utils/date-range-utils";
import { TableHeaderControls } from "@/src/components/table/table-header-controls";
+import { TimeRangePicker } from "@/src/components/date-picker";
+import { DataTableRefreshButton } from "@/src/components/table/data-table-refresh-button";
+import { MobileFiltersSheet } from "@/src/features/events/components/MobileFiltersSheet";
+import { useIsMobile } from "@/src/hooks/use-mobile";
import { type ScoreAggregate } from "@langfuse/shared";
import TagList from "@/src/features/tag/components/TagList";
import { usePeekTableState } from "@/src/components/table/peek/contexts/PeekTableStateContext";
@@ -114,6 +119,7 @@ import { showSuccessToast } from "@/src/features/notifications/showSuccessToast"
import { useSearchBarEnabled } from "@/src/features/search-bar/hooks/useSearchBarEnabled";
import { useEventsSearchBar } from "@/src/features/search-bar/hooks/useEventsSearchBar";
import { EventsSearchBarRow } from "@/src/features/search-bar/components/EventsSearchBarRow";
+import { MobileFullTextSearch } from "@/src/features/events/components/MobileFullTextSearch";
import { buildAiContext } from "@/src/features/search-bar/lib/ai-context";
import {
observedScoreNamesFromOptions,
@@ -1060,10 +1066,15 @@ export default function ObservationsEventsTable({
},
];
+ // Mobile collapses the whole toolbar away, so the batch-action surface (the
+ // action menu + select-all banner it hosts) is gone β€” orphan selection
+ // checkboxes would do nothing. Omit the select column on mobile until a
+ // dedicated mobile action affordance exists.
+ const isMobile = useIsMobile();
const enableSorting = !hideControls;
const columns: LangfuseColumnDef<EventsTableRow>[] = [
- ...(hideControls ? [] : [selectActionColumn]),
+ ...(hideControls || isMobile ? [] : [selectActionColumn]),
{
accessorKey: "startTime",
id: "startTime",
@@ -1819,17 +1830,153 @@ export default function ObservationsEventsTable({
setInterval: setRefreshInterval,
};
+ // Mobile collapses the whole toolbar into one Filters bottom sheet. Desktop
+ // (β‰₯768px) is byte-identical to before β€” everything below is gated on
+ // `isMobile`, declared above near the column list.
+ // Count shown on the mobile Filters trigger. Same source as the desktop
+ // rail's active-facet count β€” distinct filtered COLUMNS (a facet can emit
+ // several FilterState entries) β€” plus free-text search, which now also lives
+ // in the sheet.
+ const mobileActiveFilterCount =
+ new Set(
+ (queryFilter.explicitFilterState ?? []).map((filter) => filter.column),
+ ).size + (searchQuery && searchQuery.trim().length > 0 ? 1 : 0);
+
return (
<DataTableControlsProvider tableName={eventsFilterConfig.tableName}>
<div className="flex h-full w-full flex-col">
- {showControlsInPageHeader && !hideControls && (
+ {showControlsInPageHeader && !hideControls && !isMobile && (
<TableHeaderControls
timeRange={timeRange}
setTimeRange={setTimeRange}
refresh={refreshConfig}
/>
)}
- {!hideControls && (
+ {/* Mobile: a single toolbar row β€” Filters(N) sheet trigger + view-mode
+ toggle. Search, time range, preset chips, saved views and the facet
+ sidebar all move INTO the sheet (same controllers, hosted there).
+ Columns / row-height / export are omitted on the card list. */}
+ {!hideControls && isMobile && (
+ <div className="my-2 flex items-center gap-2 px-2">
+ <MobileFiltersSheet
+ activeCount={mobileActiveFilterCount}
+ resultCount={totalCount}
+ onClearAll={() => {
+ queryFilter.clearAll();
+ setSearchQuery("");
+ }}
+ search={
+ searchBarMode ? (
+ <EventsSearchBarRow
+ projectId={projectId}
+ tableName={eventsFilterConfig.tableName}
+ store={searchBarStore}
+ commit={searchBarCommit}
+ observed={observedOptions}
+ erroredColumns={erroredColumns}
+ fieldReason={
+ chartActive ? chartSearchFieldReason : undefined
+ }
+ freeTextReason={
+ chartFreeTextIgnored
+ ? CHART_SEARCH_QUERY_REASON
+ : undefined
+ }
+ onApplyFilters={searchBarApplyFilters}
+ onRequestColumns={requestColumns}
+ aiDataContext={aiDataContext}
+ aiScoreNames={aiScoreNames}
+ // Flush inside the sheet: the section container owns the
+ // padding, so the bar lines up with time range / presets.
+ className="p-0"
+ />
+ ) : (
+ // No grammar bar (userId/sessionId-scoped tables): fall back
+ // to the legacy full-text search so mobile keeps the search
+ // desktop has via the toolbar's searchConfig (LFE-11067).
+ <MobileFullTextSearch
+ currentQuery={searchQuery ?? undefined}
+ updateQuery={setSearchQuery}
+ tableAllowsFullTextSearch
+ metadataSearchFields={["ID", "Name", "Trace Name", "Model"]}
+ />
+ )
+ }
+ headerControls={
+ // Compact time-range + refresh, pulled up into the sheet's
+ // header row so the body is a single uninterrupted scroll.
+ <div className="flex min-w-0 items-center gap-1">
+ <TimeRangePicker
+ compact
+ timeRange={timeRange}
+ onTimeRangeChange={setTimeRange}
+ timeRangePresets={TABLE_AGGREGATION_OPTIONS}
+ className="my-0"
+ />
+ <DataTableRefreshButton
+ compact
+ onRefresh={refreshConfig.onRefresh}
+ isRefreshing={refreshConfig.isRefreshing}
+ interval={refreshConfig.interval}
+ setInterval={refreshConfig.setInterval}
+ />
+ </div>
+ }
+ presets={
+ tableStatePolicy.disableSavedViews ? undefined : (
+ <CategoryPresetChips
+ projectId={projectId}
+ activeViewId={
+ viewControllers.appliedViewId ??
+ viewControllers.selectedViewId
+ }
+ onApplyView={viewControllers.handleSetViewId}
+ applyViewState={viewControllers.applyViewState}
+ onPreviewView={previewViewInSearchBar}
+ />
+ )
+ }
+ savedViews={
+ tableStatePolicy.disableSavedViews ? undefined : (
+ <TableViewPresetsDrawer
+ viewConfig={{
+ tableName: TableViewPresetTableName.ObservationsEvents,
+ projectId,
+ controllers: viewControllers,
+ }}
+ currentState={{
+ orderBy: orderByState ?? null,
+ filters: queryFilter.explicitFilterState ?? [],
+ columnOrder,
+ columnVisibility,
+ searchQuery: searchQuery ?? "",
+ }}
+ />
+ )
+ }
+ facets={
+ <DataTableControls
+ key={viewControllers.selectedViewId ?? "no-view"}
+ queryFilter={queryFilter}
+ filterWithAI={!searchBarMode}
+ blockedColumnReason={
+ chartActive ? chartFilterExclusionReason : undefined
+ }
+ // inline: flow at natural height in the sheet's single scroll
+ // (no internal ScrollArea). Desktop sidebar stays default.
+ layout="inline"
+ />
+ }
+ />
+ {chartEnabled && (
+ <ViewModeToggle
+ mode={chartViewMode}
+ onModeChange={setChartViewMode}
+ />
+ )}
+ </div>
+ )}
+ {!hideControls && !isMobile && (
<div
className={cn(
// This is a table-internal sticky band below PageHeader. Using
@@ -2019,7 +2166,10 @@ export default function ObservationsEventsTable({
{/* Content area with sidebar and table. The facet sidebar stays in
search-bar mode and syncs bidirectionally with the bar. */}
<ResizableFilterLayout>
- {!hideControls && (
+ {/* On mobile the facet sidebar moves into the Filters sheet above,
+ so it is not rendered inline here (leaving only the table content
+ in the layout). */}
+ {!hideControls && !isMobile && (
<DataTableControls
// Remount the sidebar when the saved view changes so the new view's filters replace any stale draft UI state.
key={viewControllers.selectedViewId ?? "no-view"}
diff --git a/web/src/features/events/components/MobileFiltersSheet.stories.tsx b/web/src/features/events/components/MobileFiltersSheet.stories.tsx
new file mode 100644
index 0000000000..70f746422b
--- /dev/null
+++ b/web/src/features/events/components/MobileFiltersSheet.stories.tsx
@@ -0,0 +1,144 @@
+import preview from "../../../../.storybook/preview";
+import { useState, type ComponentProps } from "react";
+import { fn } from "storybook/test";
+import { ChevronDown, RefreshCw } from "lucide-react";
+
+import { MobileFiltersSheet } from "@/src/features/events/components/MobileFiltersSheet";
+import { ControlsContext } from "@/src/components/table/data-table-controls";
+import { Badge } from "@/src/components/ui/badge";
+import { Button } from "@/src/components/ui/button";
+import { Input } from "@/src/components/ui/input";
+
+// =============================================================================
+// WHY THIS STORY FAKES THE CONTROL NODES
+// =============================================================================
+// `MobileFiltersSheet` is a pure LAYOUT surface: EventsTable builds the real
+// controllers (grammar search bar, time-range picker, preset chips, saved-views
+// drawer, facet sidebar) and passes them in as nodes. Those controllers depend
+// on tRPC, routing and several providers, so the story substitutes structural
+// placeholders that stand in for each section. This exercises the sheet's own
+// concerns β€” the header controls cluster, the pinned search, labeled sections,
+// sticky footer, active-count badge, and the single-scroll body (presets, saved
+// views and facets flowing together) β€” without dragging the whole page in.
+//
+// Open state is read from `ControlsContext` (the DataTableControls provider).
+// The demo wrapper supplies that context with `open: true` so the sheet renders
+// open; the trigger button and the footer's close still toggle it live.
+
+const fakeSearch = <Input placeholder="Search traces…" className="h-9" />;
+
+// Compact time-range + refresh cluster, as EventsTable builds it for the header
+// row (label-only time range, refresh split with a chevron).
+const fakeHeaderControls = (
+ <div className="flex min-w-0 items-center gap-1">
+ <Button variant="outline" size="sm" className="h-8 min-w-0">
+ <span className="truncate">Past 24 hours</span>
+ </Button>
+ <div className="flex items-center">
+ <Button
+ variant="outline"
+ size="icon"
+ className="h-8 w-8 rounded-r-none border-r-0"
+ >
+ <RefreshCw className="h-4 w-4" />
+ </Button>
+ <Button
+ variant="outline"
+ size="icon"
+ className="h-8 w-auto rounded-l-none border-l-0 px-2"
+ >
+ <ChevronDown className="h-4 w-4" />
+ </Button>
+ </div>
+ </div>
+);
+
+const fakePresets = (
+ <div className="flex flex-wrap gap-2">
+ {["Quality", "Slow", "Cost"].map((chip) => (
+ <Badge key={chip} variant="outline" className="cursor-pointer">
+ {chip}
+ </Badge>
+ ))}
+ </div>
+);
+
+const fakeSavedViews = (
+ <Button variant="outline" size="sm" className="h-8">
+ My Views
+ </Button>
+);
+
+// Stand-in for DataTableControls in layout="inline": its own "Filters" header +
+// a facet list that flows at NATURAL height (no internal scroll), so it reads
+// correctly inside the sheet's single body scroll.
+const fakeFacets = (
+ <div className="bg-background flex w-full flex-col border-t">
+ <div className="flex h-10 shrink-0 items-center gap-1.5 border-b px-3">
+ <span className="text-sm font-bold">Filters</span>
+ </div>
+ <div className="w-full">
+ {[
+ "Name",
+ "Environment",
+ "Level",
+ "Tags",
+ "Model",
+ "User",
+ "Session",
+ "Latency",
+ "Cost",
+ "Metadata",
+ ].map((facet) => (
+ <div
+ key={facet}
+ className="text-muted-foreground border-b px-3 py-2 text-sm"
+ >
+ {facet}
+ </div>
+ ))}
+ </div>
+ </div>
+);
+
+function MobileFiltersSheetDemo(
+ props: ComponentProps<typeof MobileFiltersSheet>,
+) {
+ const [open, setOpen] = useState(true);
+ return (
+ <ControlsContext.Provider
+ value={{ open, setOpen, tableName: "storybook", isMobile: true }}
+ >
+ <MobileFiltersSheet {...props} />
+ </ControlsContext.Provider>
+ );
+}
+
+const meta = preview.meta({
+ component: MobileFiltersSheetDemo,
+ parameters: { layout: "fullscreen" },
+ args: {
+ activeCount: 0,
+ resultCount: null,
+ onClearAll: fn(),
+ search: fakeSearch,
+ headerControls: fakeHeaderControls,
+ presets: fakePresets,
+ savedViews: fakeSavedViews,
+ facets: fakeFacets,
+ },
+});
+
+export default meta;
+
+// Open sheet, no active filters β€” trigger badge hidden, footer reads
+// "Show results" (count unknown, as on the lazily-counted events table).
+export const Default = meta.story({});
+
+// Active filters set the trigger badge and a known result count in the footer.
+export const WithActiveFilters = meta.story({
+ args: {
+ activeCount: 3,
+ resultCount: 1284,
+ },
+});
diff --git a/web/src/features/events/components/MobileFiltersSheet.tsx b/web/src/features/events/components/MobileFiltersSheet.tsx
new file mode 100644
index 0000000000..ace1570a05
--- /dev/null
+++ b/web/src/features/events/components/MobileFiltersSheet.tsx
@@ -0,0 +1,163 @@
+"use client";
+
+import { type ReactNode } from "react";
+import { SlidersHorizontal, X } from "lucide-react";
+
+import { Badge } from "@/src/components/ui/badge";
+import { Button } from "@/src/components/ui/button";
+import {
+ Sheet,
+ SheetClose,
+ SheetContent,
+ SheetTitle,
+ SheetTrigger,
+} from "@/src/components/ui/sheet";
+import { useDataTableControls } from "@/src/components/table/data-table-controls";
+import { numberFormatter } from "@/src/utils/numbers";
+
+interface MobileFiltersSheetProps {
+ /** Count shown on the trigger badge β€” active facet columns (+ free-text
+ * search, which also lives in this sheet now). Derived by the caller from
+ * the same sidebar filter state the desktop rail counts. */
+ activeCount: number;
+ /** Total matching results for the "Show N results" footer button. Null when
+ * the count is unknown (the events table counts lazily), which renders a
+ * plain "Show results" label instead. */
+ resultCount: number | null;
+ /** Clears filter state + search. Results update live, so this does not close
+ * the sheet. */
+ onClearAll: () => void;
+ /** Grammar search bar row (search-bar mode only). */
+ search?: ReactNode;
+ /** Compact controls rendered in the header row, right of the title and left
+ * of the close button β€” the time-range picker + refresh cluster. */
+ headerControls?: ReactNode;
+ /** Category preset chips. */
+ presets?: ReactNode;
+ /** Saved-views drawer trigger ("My Views"). */
+ savedViews?: ReactNode;
+ /** Facet list (DataTableControls, layout="inline"). Owns its own "Filters"
+ * header + count badge and flows at NATURAL height inside the single body
+ * scroll β€” no bounded region or nested scroll of its own. */
+ facets?: ReactNode;
+}
+
+function Section({ label, children }: { label: string; children: ReactNode }) {
+ if (!children) return null;
+ return (
+ // `if (!children)` only catches a null PROP; a child COMPONENT that renders
+ // null (e.g. CategoryPresetChips while its query loads, or with no system
+ // presets) leaves a truthy element but no DOM. Hide the section via CSS when
+ // the heading is its only rendered child, so no bare label floats over empty
+ // space.
+ <section className="flex flex-col gap-2 [&:has(>h3:only-child)]:hidden">
+ <h3 className="text-muted-foreground text-xs font-bold tracking-wide uppercase">
+ {label}
+ </h3>
+ {children}
+ </section>
+ );
+}
+
+/**
+ * Mobile-only bottom sheet that collapses the traces toolbar's scattered
+ * filter controls into ONE surface: search Β· time range Β· quick presets Β·
+ * saved views Β· facets. It hosts the SAME controllers EventsTable already
+ * builds for desktop (passed in as nodes) β€” a presentation reshuffle, not a
+ * state migration.
+ *
+ * Open state is the shared DataTableControls context (`mobileOpen`), so the
+ * facet list expands (its rail-vs-expanded toggle keys off the provider's
+ * `data-expanded`) and its in-sheet "Hide filters" button closes the sheet.
+ */
+export function MobileFiltersSheet({
+ activeCount,
+ resultCount,
+ onClearAll,
+ search,
+ headerControls,
+ presets,
+ savedViews,
+ facets,
+}: MobileFiltersSheetProps) {
+ const { open, setOpen } = useDataTableControls();
+
+ return (
+ <Sheet open={open} onOpenChange={setOpen}>
+ <SheetTrigger asChild>
+ <Button variant="outline" size="sm" className="h-8 shrink-0 gap-2">
+ <SlidersHorizontal className="h-4 w-4" />
+ <span>Filters</span>
+ {activeCount > 0 && (
+ <Badge variant="secondary" className="ml-0.5 h-5 px-1.5 text-xs">
+ {activeCount}
+ </Badge>
+ )}
+ </Button>
+ </SheetTrigger>
+ <SheetContent
+ side="bottom"
+ // No description; tell Radix it is intentional so it doesn't warn.
+ aria-describedby={undefined}
+ // Hide the wrapper's default close X (our header provides one) and
+ // drop the default padding/gap so header/search/body/footer own their
+ // spacing. A DEFINITE height (not max-h) is required so the flex chain
+ // hands the single body scroll container a bounded, resolvable height β€”
+ // otherwise it can't scroll on mobile (max-h alone doesn't propagate).
+ className="flex h-[85svh] flex-col gap-0 p-0 [&>button]:hidden"
+ >
+ {/* Accessible name for the dialog; the visible heading is below. */}
+ <SheetTitle className="sr-only">Filters</SheetTitle>
+ {/* Header: title (left) Β· compact time-range + refresh Β· close (right).
+ The controls that used to sit in the body move up here so the body
+ below is a single uninterrupted scroll. */}
+ <div className="flex shrink-0 items-center gap-2 border-b px-4 py-3">
+ <span className="text-foreground text-lg font-bold">Filters</span>
+ <div className="ml-auto flex min-w-0 items-center gap-1">
+ {headerControls}
+ <SheetClose asChild>
+ <Button
+ variant="ghost"
+ size="icon"
+ aria-label="Close filters"
+ className="h-8 w-8 shrink-0"
+ >
+ <X className="h-4 w-4" />
+ </Button>
+ </SheetClose>
+ </div>
+ </div>
+
+ {/* Search is the only PINNED body element: the bar itself reads as
+ search, so it needs no label. */}
+ {search && <div className="shrink-0 border-b px-4 py-3">{search}</div>}
+
+ {/* ONE scroll container: quick presets Β· my views Β· facets all flow
+ together in a single scroll. The facet list is layout="inline", so
+ it contributes its natural height here instead of a nested scroll. */}
+ <div className="flex min-h-0 flex-1 flex-col overflow-y-auto">
+ {(presets || savedViews) && (
+ <div className="flex flex-col gap-5 px-4 py-4">
+ <Section label="Quick presets">{presets}</Section>
+ <Section label="My views">{savedViews}</Section>
+ </div>
+ )}
+ {facets}
+ </div>
+
+ <div className="flex shrink-0 items-center gap-2 border-t px-4 py-3">
+ <Button variant="outline" className="flex-1" onClick={onClearAll}>
+ Clear all
+ </Button>
+ <SheetClose asChild>
+ <Button className="flex-1">
+ {resultCount != null
+ ? `Show ${numberFormatter(resultCount, 0)} results`
+ : "Show results"}
+ </Button>
+ </SheetClose>
+ </div>
+ </SheetContent>
+ </Sheet>
+ );
+}
diff --git a/web/src/features/events/components/MobileFullTextSearch.tsx b/web/src/features/events/components/MobileFullTextSearch.tsx
new file mode 100644
index 0000000000..21975b5b1d
--- /dev/null
+++ b/web/src/features/events/components/MobileFullTextSearch.tsx
@@ -0,0 +1,94 @@
+"use client";
+
+import { useState } from "react";
+import { Search } from "lucide-react";
+
+import { Button } from "@/src/components/ui/button";
+import { Input } from "@/src/components/ui/input";
+import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
+
+/**
+ * Full-text search input for the mobile Filters sheet, used when the grammar
+ * search bar is unavailable β€” i.e. `searchBarMode` is off, which is the case
+ * for userId/sessionId-scoped events tables (the embedded "events for this
+ * user/session" tabs). On desktop those tables keep full-text search via the
+ * toolbar's `searchConfig`; the toolbar is collapsed away on mobile, so without
+ * this the search would be unreachable there (LFE-11067).
+ *
+ * Mirrors the toolbar's search input: submit on Enter (or the icon), clear
+ * immediately when emptied. It uses the table's CURRENT search type β€” the
+ * type selector stays a desktop-only refinement, not the core capability the
+ * mobile surface needs restored. The draft is local; the sheet unmounts on
+ * close, so reopening re-seeds it from the committed query.
+ */
+export function MobileFullTextSearch({
+ currentQuery,
+ updateQuery,
+ tableAllowsFullTextSearch,
+ metadataSearchFields,
+}: {
+ currentQuery?: string;
+ updateQuery: (query: string) => void;
+ tableAllowsFullTextSearch?: boolean;
+ metadataSearchFields?: string[];
+}) {
+ const capture = usePostHogClientCapture();
+ const committed = currentQuery ?? "";
+ const [draft, setDraft] = useState(committed);
+ // Re-seed the draft when the committed query changes underneath us β€” e.g. the
+ // sheet's "Clear all" (which does NOT close the sheet, so this stays mounted)
+ // empties the query while the input still holds typed text. React's
+ // adjust-state-during-render pattern (not an effect): on the user's own
+ // submit the committed value already equals the draft, so this is a no-op.
+ const [lastCommitted, setLastCommitted] = useState(committed);
+ if (committed !== lastCommitted) {
+ setLastCommitted(committed);
+ setDraft(committed);
+ }
+
+ const submit = (query: string) => {
+ capture("table:search_submit");
+ updateQuery(query);
+ };
+
+ return (
+ <div className="border-input bg-background flex h-9 min-w-0 items-center rounded-md border pl-2">
+ <Button
+ variant="ghost"
+ size="icon"
+ aria-label="Search"
+ className="mr-1 h-7 w-7 shrink-0"
+ onClick={() => submit(draft)}
+ >
+ <Search className="h-4 w-4" />
+ </Button>
+ <Input
+ placeholder={
+ tableAllowsFullTextSearch
+ ? "Search…"
+ : `Search (${metadataSearchFields?.join(", ") ?? ""})`
+ }
+ value={draft}
+ onChange={(event) => {
+ const next = event.currentTarget.value;
+ setDraft(next);
+ // Match the toolbar: clearing the field applies immediately so the
+ // list unfilters without needing an explicit submit.
+ if (next === "") submit("");
+ }}
+ onKeyDown={(event) => {
+ if (event.key === "Enter") submit(draft);
+ }}
+ // Commit on blur too, so tapping the sheet's "Show results" (or anywhere
+ // outside the field) applies a typed-but-not-Entered query instead of
+ // discarding it β€” matching the grammar bar's commit-on-blur. Guarded so
+ // a focus/blur without changes (or right after an icon/Enter submit)
+ // doesn't re-fire.
+ onBlur={() => {
+ if (draft !== committed) submit(draft);
+ }}
+ className="w-full min-w-0 border-none bg-transparent px-0 text-sm focus-visible:ring-0 focus-visible:outline-hidden"
+ />
+ </div>
+ );
+}
diff --git a/web/src/features/search-bar/components/EventsSearchBarRow.tsx b/web/src/features/search-bar/components/EventsSearchBarRow.tsx
index f0e04837fe..a41cc4c002 100644
--- a/web/src/features/search-bar/components/EventsSearchBarRow.tsx
+++ b/web/src/features/search-bar/components/EventsSearchBarRow.tsx
@@ -18,6 +18,7 @@ import * as React from "react";
import { type FilterState } from "@langfuse/shared";
import { useLangfuseCloudRegion } from "@/src/features/organizations/hooks";
import { useQueryProject } from "@/src/features/projects/hooks";
+import { cn } from "@/src/utils/tailwind";
import type {
ObservedOptions,
ObservedScoreNames,
@@ -42,6 +43,7 @@ export function EventsSearchBarRow({
onRequestColumns,
aiDataContext,
aiScoreNames,
+ className,
}: {
projectId: string;
/** Table this bar filters β€” threaded to AI-prompt analytics (LFE-10781). */
@@ -77,6 +79,10 @@ export function EventsSearchBarRow({
/** Observed score names by column type, for the server's score-name
* validation of the generated filters (undefined sets are not enforced). */
aiScoreNames?: ObservedScoreNames;
+ /** Overrides the wrapper spacing. The default (`px-2 pt-2 pb-1`) aligns the
+ * bar with the desktop toolbar row; the mobile Filters sheet passes flush
+ * padding so the bar lines up with the sheet's other sections. */
+ className?: string;
}) {
const [aiOpen, setAiOpen] = React.useState(false);
const { isLangfuseCloud } = useLangfuseCloudRegion();
@@ -94,7 +100,7 @@ export function EventsSearchBarRow({
}, [onRequestColumns]);
return (
- <div className="min-w-0 px-2 pt-2 pb-1">
+ <div className={cn("min-w-0 px-2 pt-2 pb-1", className)}>
{aiOpen && aiAvailable ? (
<SearchBarAiPrompt
projectId={projectId}