Skip to content

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

fix(web): large search bar on full-page lists (#18474)

Trang Nguyen0e8a207e880b
diff --git a/web/src/components/design-system/SearchInput/SearchInput.stories.tsx b/web/src/components/design-system/SearchInput/SearchInput.stories.tsx
index af72d513b6..04f2313bb9 100644
--- a/web/src/components/design-system/SearchInput/SearchInput.stories.tsx
+++ b/web/src/components/design-system/SearchInput/SearchInput.stories.tsx
@@ -48,6 +48,16 @@ const meta = preview.meta({
export const Default = meta.story({});
+/** `default` for embedded toolbars, `large` for full-page lists. */
+export const Sizes = meta.story({
+ render: (args) => (
+ <div className="flex flex-col gap-3">
+ <InteractiveSearchInput {...args} size="default" />
+ <InteractiveSearchInput {...args} size="large" />
+ </div>
+ ),
+});
+
export const WithDropdown = meta.story({
args: {
dropdown,
diff --git a/web/src/features/datasets/components/DatasetItemsTable.tsx b/web/src/features/datasets/components/DatasetItemsTable.tsx
index 43cf6ebcf7..ced8a82acf 100644
--- a/web/src/features/datasets/components/DatasetItemsTable.tsx
+++ b/web/src/features/datasets/components/DatasetItemsTable.tsx
@@ -363,6 +363,7 @@ export function DatasetItemsTable({
const isMobile = useMediaQuery({ query: "(max-width: 767.98px)" });
const searchBar = (
<TableSearchBar
+ size="large"
key={`${projectId}:${datasetId}:${selectedVersion?.toISOString() ?? "latest"}`}
projectId={projectId}
tableName="dataset-items"
diff --git a/web/src/features/evals/components/eval-log.tsx b/web/src/features/evals/components/eval-log.tsx
index 1085172c01..3805a60bf7 100644
--- a/web/src/features/evals/components/eval-log.tsx
+++ b/web/src/features/evals/components/eval-log.tsx
@@ -265,6 +265,7 @@ export default function EvalLogTable({
<SearchableTableFilterLayout
search={
<TableSearchBar
+ size="large"
key={queryFilter.draftResetKey}
projectId={projectId}
tableName={evalLogFilterConfig.tableName}
diff --git a/web/src/features/evals/components/evaluator-table.tsx b/web/src/features/evals/components/evaluator-table.tsx
index 658e050db2..1d02dda852 100644
--- a/web/src/features/evals/components/evaluator-table.tsx
+++ b/web/src/features/evals/components/evaluator-table.tsx
@@ -443,6 +443,7 @@ export default function EvaluatorTable({ projectId }: { projectId: string }) {
<SearchableTableFilterLayout
search={
<TableSearchBar
+ size="large"
key={queryFilter.draftResetKey}
projectId={projectId}
tableName={evaluatorFilterConfig.tableName}
diff --git a/web/src/features/evals/v2/components/Rules/RuleFilterPills/RuleFilterPills.tsx b/web/src/features/evals/v2/components/Rules/RuleFilterPills/RuleFilterPills.tsx
index 2d2aa3ff5d..73111c7a2a 100644
--- a/web/src/features/evals/v2/components/Rules/RuleFilterPills/RuleFilterPills.tsx
+++ b/web/src/features/evals/v2/components/Rules/RuleFilterPills/RuleFilterPills.tsx
@@ -11,12 +11,11 @@ import {
import { RULE_FIELD_REGISTRY } from "@/src/features/evals/v2/constants/ruleSearchRegistry";
import { InlineFilterState } from "@/src/features/filters";
import {
- COMPOSER_SURFACE_CLASSES,
- COMPOSER_TEXT_CLASSES,
+ ComposerSurface,
+ ComposerText,
ComposerTokens,
filterStateToQueryText,
} from "@/src/features/search-bar";
-import { cn } from "@/src/utils/tailwind";
export function RuleFilterPills({
filter,
@@ -55,49 +54,53 @@ export function RuleFilterPills({
if (display === "search-bar") {
if (disabledReasons?.size) {
return (
- <div
- aria-disabled="true"
- data-testid="readonly-rule-filter-search"
- className={cn(COMPOSER_SURFACE_CLASSES, "bg-muted/30")}
- >
- <div className={COMPOSER_TEXT_CLASSES}>
- {filter.length === 0 ? (
- <span className="text-muted-foreground">No filters</span>
- ) : (
- filter.map((condition, index) => {
- const query = filterStateToQueryText(
- [condition],
- {},
- RULE_FIELD_REGISTRY,
- );
- const key = `${index}-${JSON.stringify(condition)}`;
- const content = query.text ? (
- <ComposerTokens
- draft={query.text}
- showDiagnostics={false}
- registry={RULE_FIELD_REGISTRY}
- />
+ <ComposerSurface tone="muted">
+ <div aria-disabled="true" data-testid="readonly-rule-filter-search">
+ <ComposerText>
+ <div>
+ {filter.length === 0 ? (
+ <span className="text-muted-foreground">No filters</span>
) : (
- <InlineFilterState
- filterState={query.skippedFilters}
- className="m-0"
- />
- );
+ filter.map((condition, index) => {
+ const query = filterStateToQueryText(
+ [condition],
+ {},
+ RULE_FIELD_REGISTRY,
+ );
+ const key = `${index}-${JSON.stringify(condition)}`;
+ const content = query.text ? (
+ <ComposerTokens
+ draft={query.text}
+ showDiagnostics={false}
+ registry={RULE_FIELD_REGISTRY}
+ />
+ ) : (
+ <InlineFilterState
+ filterState={query.skippedFilters}
+ className="m-0"
+ />
+ );
- return (
- <span key={key}>
- {index > 0 ? (
- <span className="text-qlang-keyword mx-1 font-bold uppercase">
- and
+ return (
+ <span key={key}>
+ {index > 0 ? (
+ <span className="text-qlang-keyword mx-1 font-bold uppercase">
+ and
+ </span>
+ ) : null}
+ {renderWithDisabledReason(
+ content,
+ index,
+ `${key}-filter`,
+ )}
</span>
- ) : null}
- {renderWithDisabledReason(content, index, `${key}-filter`)}
- </span>
- );
- })
- )}
+ );
+ })
+ )}
+ </div>
+ </ComposerText>
</div>
- </div>
+ </ComposerSurface>
);
}
@@ -105,28 +108,28 @@ export function RuleFilterPills({
const hasFilters = Boolean(query.text || query.skippedFilters.length > 0);
return (
- <div
- aria-disabled="true"
- data-testid="readonly-rule-filter-search"
- className={cn(COMPOSER_SURFACE_CLASSES, "bg-muted/30")}
- >
- <div className={COMPOSER_TEXT_CLASSES}>
- {query.text ? (
- <ComposerTokens
- draft={query.text}
- showDiagnostics={false}
- registry={RULE_FIELD_REGISTRY}
- />
- ) : null}
- <InlineFilterState
- filterState={query.skippedFilters}
- className="m-0"
- />
- {!hasFilters ? (
- <span className="text-muted-foreground">No filters</span>
- ) : null}
+ <ComposerSurface tone="muted">
+ <div aria-disabled="true" data-testid="readonly-rule-filter-search">
+ <ComposerText>
+ <div>
+ {query.text ? (
+ <ComposerTokens
+ draft={query.text}
+ showDiagnostics={false}
+ registry={RULE_FIELD_REGISTRY}
+ />
+ ) : null}
+ <InlineFilterState
+ filterState={query.skippedFilters}
+ className="m-0"
+ />
+ {!hasFilters ? (
+ <span className="text-muted-foreground">No filters</span>
+ ) : null}
+ </div>
+ </ComposerText>
</div>
- </div>
+ </ComposerSurface>
);
}
diff --git a/web/src/features/evals/v2/components/Rules/RulesTable/RulesTable.tsx b/web/src/features/evals/v2/components/Rules/RulesTable/RulesTable.tsx
index af1676aed9..a7527bbefb 100644
--- a/web/src/features/evals/v2/components/Rules/RulesTable/RulesTable.tsx
+++ b/web/src/features/evals/v2/components/Rules/RulesTable/RulesTable.tsx
@@ -534,6 +534,7 @@ export function RulesTable({
<SearchableTableFilterLayout
search={
<TableSearchBar
+ size="large"
key={`${viewControllers.filterEditorResetKey}:${queryFilter.draftResetKey}`}
projectId={projectId}
tableName={filterConfig.tableName}
diff --git a/web/src/features/evals/v2/pages/EvaluatorsPage.tsx b/web/src/features/evals/v2/pages/EvaluatorsPage.tsx
index 7b1f47b0c0..49c5272e31 100644
--- a/web/src/features/evals/v2/pages/EvaluatorsPage.tsx
+++ b/web/src/features/evals/v2/pages/EvaluatorsPage.tsx
@@ -698,6 +698,7 @@ export default function EvaluatorsPage() {
<SearchableTableFilterLayout
search={
<TableSearchBar
+ size="large"
key={`${viewControllers.filterEditorResetKey}:${queryFilter.draftResetKey}`}
projectId={projectId}
tableName={filterConfig.tableName}
diff --git a/web/src/features/events/components/EventsTable.tsx b/web/src/features/events/components/EventsTable.tsx
index 5a660b8d32..74ec76a066 100644
--- a/web/src/features/events/components/EventsTable.tsx
+++ b/web/src/features/events/components/EventsTable.tsx
@@ -1875,6 +1875,7 @@ export default function ObservationsEventsTable({
searchBarMode ? (
<div className="flex min-w-0 flex-col gap-2">
<EventsSearchBarRow
+ size={showControlsInPageHeader ? "large" : "default"}
key={`${viewControllers.filterEditorResetKey}-${queryFilter.draftResetKey}`}
registry={searchRegistry}
projectId={projectId}
@@ -2008,6 +2009,7 @@ export default function ObservationsEventsTable({
<div className="flex min-w-0 items-center gap-2">
<div className="min-w-0 flex-1">
<EventsSearchBarRow
+ size={showControlsInPageHeader ? "large" : "default"}
key={`${viewControllers.filterEditorResetKey}-${queryFilter.draftResetKey}`}
registry={searchRegistry}
projectId={projectId}
diff --git a/web/src/features/experiments/components/table/ExperimentItemsTable.tsx b/web/src/features/experiments/components/table/ExperimentItemsTable.tsx
index 33afc4bd26..850bb749c9 100644
--- a/web/src/features/experiments/components/table/ExperimentItemsTable.tsx
+++ b/web/src/features/experiments/components/table/ExperimentItemsTable.tsx
@@ -2008,6 +2008,7 @@ export default function ExperimentItemsTable({
search={
hideControls ? null : (
<TableSearchBar
+ size="large"
key={`${projectId}:${viewControllers.filterEditorResetKey}:${queryFilter.draftResetKey}`}
projectId={projectId}
tableName="experiment-items"
diff --git a/web/src/features/experiments/components/table/ExperimentsTable.tsx b/web/src/features/experiments/components/table/ExperimentsTable.tsx
index 740a2b86c3..1aed4983c1 100644
--- a/web/src/features/experiments/components/table/ExperimentsTable.tsx
+++ b/web/src/features/experiments/components/table/ExperimentsTable.tsx
@@ -980,6 +980,7 @@ export default function ExperimentsTable({
<StickySearchableTableFilterLayout
search={
<TableSearchBar
+ size={showControlsInPageHeader ? "large" : "default"}
key={`${viewControllers.filterEditorResetKey}-${queryFilter.draftResetKey}`}
isV4={true}
filterState={queryFilter.searchBarFilterState}
diff --git a/web/src/features/monitors/components/MonitorsTable.tsx b/web/src/features/monitors/components/MonitorsTable.tsx
index c3a4f22607..65bec6c944 100644
--- a/web/src/features/monitors/components/MonitorsTable.tsx
+++ b/web/src/features/monitors/components/MonitorsTable.tsx
@@ -310,6 +310,7 @@ export function MonitorsTable() {
<SearchableTableFilterLayout
search={
<TableSearchBar
+ size="large"
key={`${projectId}:${viewControllers.filterEditorResetKey}:${queryFilter.draftResetKey}`}
projectId={projectId}
tableName="monitors"
diff --git a/web/src/features/prompts/components/prompts-table.tsx b/web/src/features/prompts/components/prompts-table.tsx
index 2e5cd27aed..063ba4d31d 100644
--- a/web/src/features/prompts/components/prompts-table.tsx
+++ b/web/src/features/prompts/components/prompts-table.tsx
@@ -508,6 +508,7 @@ export function PromptTable() {
<SearchableTableFilterLayout
search={
<TableSearchBar
+ size="large"
key={`${projectId}:${viewControllers.filterEditorResetKey}:${queryFilter.draftResetKey}`}
projectId={projectId}
tableName="prompts"
diff --git a/web/src/features/scores/ScoresTable.tsx b/web/src/features/scores/ScoresTable.tsx
index b5f22a9430..4b3f608338 100644
--- a/web/src/features/scores/ScoresTable.tsx
+++ b/web/src/features/scores/ScoresTable.tsx
@@ -1160,6 +1160,7 @@ export default function ScoresTable({
const scoresSearchBar = (
<ScoresSearchBar
+ size={showControlsInPageHeader ? "large" : "default"}
key={`${viewControllers.filterEditorResetKey}-${queryFilter.draftResetKey}`}
isV4={isV4}
projectId={projectId}
diff --git a/web/src/features/scores/components/ScoresSearchBar.tsx b/web/src/features/scores/components/ScoresSearchBar.tsx
index f126f3b73b..eedce0c62a 100644
--- a/web/src/features/scores/components/ScoresSearchBar.tsx
+++ b/web/src/features/scores/components/ScoresSearchBar.tsx
@@ -1,7 +1,11 @@
import type { FilterState } from "@langfuse/shared";
import { useMemo } from "react";
import type { FilterConfig } from "@/src/features/filters";
-import { TableSearchBar, toObservedOptions } from "@/src/features/search-bar";
+import {
+ type ComposerSize,
+ TableSearchBar,
+ toObservedOptions,
+} from "@/src/features/search-bar";
import { scoresFieldRegistry } from "@/src/features/scores/constants/scoresSearchRegistry";
@@ -14,6 +18,7 @@ export function ScoresSearchBar({
filterOptions,
isLoading,
inset = false,
+ size = "default",
}: {
projectId: string;
isV4: boolean;
@@ -23,6 +28,7 @@ export function ScoresSearchBar({
filterOptions: Parameters<typeof toObservedOptions>[0];
isLoading: boolean;
inset?: boolean;
+ size?: ComposerSize;
}) {
const registry = useMemo(
() => scoresFieldRegistry(filterConfig),
@@ -39,6 +45,7 @@ export function ScoresSearchBar({
observed={observed}
registry={registry}
inset={inset}
+ size={size}
/>
);
}
diff --git a/web/src/features/search-bar/components/ComposerSurface.tsx b/web/src/features/search-bar/components/ComposerSurface.tsx
new file mode 100644
index 0000000000..cbe0ea9df5
--- /dev/null
+++ b/web/src/features/search-bar/components/ComposerSurface.tsx
@@ -0,0 +1,95 @@
+import { Slot } from "@radix-ui/react-slot";
+import { cva } from "class-variance-authority";
+import { type ComponentPropsWithoutRef } from "react";
+
+/** Bar heights mirror the design-system SearchInput: default h-8, large h-9. */
+export type ComposerSize = "default" | "large";
+
+const composerSurfaceVariants = cva("relative rounded-md border", {
+ variants: {
+ size: {
+ default: "min-h-8 px-2 py-0.75",
+ large: "min-h-9 px-2 py-1.25",
+ },
+ tone: {
+ default: "bg-background",
+ muted: "bg-muted/30",
+ },
+ error: {
+ true: "border-destructive",
+ false: "border-input",
+ },
+ interactive: {
+ true: "focus-within:ring-1",
+ false: null,
+ },
+ // Right gutter for the top-right control: error icon or "Ask AI" button.
+ trailing: {
+ none: null,
+ icon: "pr-8",
+ button: "pr-20",
+ },
+ },
+ compoundVariants: [
+ { interactive: true, error: false, class: "focus-within:ring-ring" },
+ {
+ interactive: true,
+ error: true,
+ class: "focus-within:ring-destructive/40",
+ },
+ ],
+ defaultVariants: {
+ size: "default",
+ tone: "default",
+ error: false,
+ interactive: false,
+ trailing: "none",
+ },
+});
+
+type SlotProps = Omit<ComponentPropsWithoutRef<typeof Slot>, "className">;
+
+type ComposerSurfaceProps = SlotProps & {
+ size?: ComposerSize;
+ tone?: "default" | "muted";
+ error?: boolean;
+ interactive?: boolean;
+ trailing?: "none" | "icon" | "button";
+};
+
+/**
+ * The composer bar's box, applied to one child. Shared by the editor, the
+ * read-only preview that overlays it, and read-only filter displays, so they
+ * render pixel-identical.
+ */
+export function ComposerSurface({
+ size,
+ tone,
+ error,
+ interactive,
+ trailing,
+ ...props
+}: ComposerSurfaceProps) {
+ return (
+ <Slot
+ className={composerSurfaceVariants({
+ size,
+ tone,
+ error,
+ interactive,
+ trailing,
+ })}
+ {...props}
+ />
+ );
+}
+
+/** Query text metrics; leading-6 matches the pill height so the caret aligns. */
+export function ComposerText(props: SlotProps) {
+ return (
+ <Slot
+ className="min-h-6 font-mono text-xs leading-6 break-words whitespace-pre-wrap"
+ {...props}
+ />
+ );
+}
diff --git a/web/src/features/search-bar/components/ComposerWithPreview.stories.tsx b/web/src/features/search-bar/components/ComposerWithPreview.stories.tsx
new file mode 100644
index 0000000000..ea80e1b48d
--- /dev/null
+++ b/web/src/features/search-bar/components/ComposerWithPreview.stories.tsx
@@ -0,0 +1,53 @@
+import { useState, type ComponentProps } from "react";
+import { fn } from "storybook/test";
+import preview from "../../../../.storybook/preview";
+import { ComposerWithPreview } from "./ComposerWithPreview";
+import { SearchBarStoreProvider } from "../store/SearchBarStoreProvider";
+import { createSearchBarStore } from "../store/searchBarStore";
+
+function ComposerHost({
+ draft = "",
+ ...props
+}: ComponentProps<typeof ComposerWithPreview> & { draft?: string }) {
+ const [store] = useState(() => {
+ const created = createSearchBarStore();
+ if (draft.length > 0) created.getState().actions.setDraft(draft);
+ return created;
+ });
+ return (
+ <SearchBarStoreProvider store={store} commit={fn()}>
+ <ComposerWithPreview {...props} />
+ </SearchBarStoreProvider>
+ );
+}
+
+const meta = preview.meta({
+ component: ComposerWithPreview,
+ render: (args) => <ComposerHost {...args} />,
+ args: { observed: undefined, onActivateAi: fn() },
+ decorators: [
+ (Story) => (
+ <div className="max-w-2xl">
+ <Story />
+ </div>
+ ),
+ ],
+});
+
+export const Default = meta.story({});
+
+export const WithTokens = meta.story({
+ render: (args) => (
+ <ComposerHost {...args} draft="type:GENERATION name:pii-guardrail" />
+ ),
+});
+
+/** `default` for embedded toolbars, `large` for full-page lists. */
+export const Sizes = meta.story({
+ render: (args) => (
+ <div className="flex flex-col gap-3">
+ <ComposerHost {...args} size="default" draft="type:GENERATION" />
+ <ComposerHost {...args} size="large" draft="type:GENERATION" />
+ </div>
+ ),
+});
diff --git a/web/src/features/search-bar/components/ComposerWithPreview.tsx b/web/src/features/search-bar/components/ComposerWithPreview.tsx
index 33cdb638d2..6de855e7d8 100644
--- a/web/src/features/search-bar/components/ComposerWithPreview.tsx
+++ b/web/src/features/search-bar/components/ComposerWithPreview.tsx
@@ -15,7 +15,7 @@
// hover otherwise fed a layout-thrash loop at narrow widths: the taller field
// shifted the anchored presets dropdown out from under the cursor, changing the
// hovered row → the preview → the height, oscillating (LFE-11067). Both surfaces
-// share their chrome via composer-chrome.ts so the overlay renders pixel-identical.
+// render ComposerSurface so the overlay is pixel-identical.
import * as React from "react";
@@ -26,9 +26,9 @@ import { SearchComposer } from "@/src/features/search-bar/components/SearchCompo
import { ComposerTokens } from "@/src/features/search-bar/components/ComposerTokens";
import { useSearchBarStore } from "@/src/features/search-bar/store/SearchBarStoreProvider";
import {
- COMPOSER_SURFACE_CLASSES,
- COMPOSER_TEXT_CLASSES,
-} from "@/src/features/search-bar/components/composer-chrome";
+ ComposerSurface,
+ ComposerText,
+} from "@/src/features/search-bar/components/ComposerSurface";
export function ComposerWithPreview(
props: React.ComponentProps<typeof SearchComposer>,
@@ -68,18 +68,22 @@ export function ComposerWithPreview(
"animate-in fade-in-0 duration-150",
)}
>
- <div className={COMPOSER_SURFACE_CLASSES}>
- <div className={COMPOSER_TEXT_CLASSES}>
- <ComposerTokens
- draft={previewText}
- showDiagnostics={false}
- scoreTypes={scoreTypes}
- fieldReason={props.fieldReason}
- freeTextReason={props.freeTextReason}
- registry={props.registry}
- />
+ <ComposerSurface size={props.size}>
+ <div>
+ <ComposerText>
+ <div>
+ <ComposerTokens
+ draft={previewText}
+ showDiagnostics={false}
+ scoreTypes={scoreTypes}
+ fieldReason={props.fieldReason}
+ freeTextReason={props.freeTextReason}
+ registry={props.registry}
+ />
+ </div>
+ </ComposerText>
</div>
- </div>
+ </ComposerSurface>
</div>
)}
</div>
diff --git a/web/src/features/search-bar/components/EventsSearchBarRow.tsx b/web/src/features/search-bar/components/EventsSearchBarRow.tsx
index 21dc68f4de..b231f15583 100644
--- a/web/src/features/search-bar/components/EventsSearchBarRow.tsx
+++ b/web/src/features/search-bar/components/EventsSearchBarRow.tsx
@@ -29,6 +29,7 @@ import {
type FieldRegistry,
} from "@/src/features/search-bar/lib/fields";
import { ComposerWithPreview } from "@/src/features/search-bar/components/ComposerWithPreview";
+import { type ComposerSize } from "@/src/features/search-bar/components/ComposerSurface";
import { SearchBarAiPrompt } from "@/src/features/search-bar/components/SearchBarAiPrompt";
import { SearchBarStoreProvider } from "@/src/features/search-bar/store/SearchBarStoreProvider";
import type { SearchBarStore } from "@/src/features/search-bar/store/searchBarStore";
@@ -78,6 +79,7 @@ function EventsSearchBarRowContent({
aiScoreNames,
className,
registry = EVENTS_FIELD_REGISTRY,
+ size = "default",
}: {
aiFeaturesEnabled: boolean;
projectId?: string;
@@ -124,6 +126,8 @@ function EventsSearchBarRowContent({
className?: string;
/** The view-specific grammar and filter contract. */
registry?: FieldRegistry;
+ /** `large` on full-page lists; embedded toolbars keep the default. */
+ size?: ComposerSize;
}) {
const [aiOpen, setAiOpen] = React.useState(false);
// Mirror the legacy wand gate: org-level AI features. The server
@@ -164,6 +168,7 @@ function EventsSearchBarRowContent({
dataContext={aiDataContext}
scoreNames={aiScoreNames}
registryId={aiRegistryId}
+ size={size}
onApply={onApplyFilters}
onExit={() => setAiOpen(false)}
/>
@@ -180,6 +185,7 @@ function EventsSearchBarRowContent({
presetSections={presetSections}
onQueryPresetPick={onQueryPresetPick}
registry={registry}
+ size={size}
/>
</SearchBarStoreProvider>
)}
diff --git a/web/src/features/search-bar/components/SearchBarAiPrompt.tsx b/web/src/features/search-bar/components/SearchBarAiPrompt.tsx
index fb552b72af..403c7eeae1 100644
--- a/web/src/features/search-bar/components/SearchBarAiPrompt.tsx
+++ b/web/src/features/search-bar/components/SearchBarAiPrompt.tsx
@@ -16,6 +16,7 @@
import * as React from "react";
import { ArrowLeft, ArrowRight, Loader2 } from "lucide-react";
+import { type ComposerSize } from "@/src/features/search-bar/components/ComposerSurface";
import { useStore } from "zustand";
import { type FilterState } from "@langfuse/shared";
@@ -47,8 +48,11 @@ export function SearchBarAiPrompt({
registryId = "events",
onApply,
onExit,
+ size = "default",
}: {
projectId: string;
+ /** Matches the composer's size so switching modes keeps the bar height. */
+ size?: ComposerSize;
/** Table this bar filters — the `tableName` analytics dimension. */
tableName: string;
isV4?: boolean;
@@ -215,7 +219,8 @@ export function SearchBarAiPrompt({
<div className="relative w-full">
<div
className={cn(
- "border-input bg-background rounded-md border px-2 py-0.5",
+ "border-input bg-background rounded-md border px-2",
+ size === "large" ? "min-h-9 py-1.25" : "py-0.5",
"focus-within:ring-ring focus-within:ring-1",
error && "border-destructive focus-within:ring-destructive/40",
)}
diff --git a/web/src/features/search-bar/components/SearchComposer.tsx b/web/src/features/search-bar/components/SearchComposer.tsx
index 400b149a2c..b648e8fdea 100644
--- a/web/src/features/search-bar/components/SearchComposer.tsx
+++ b/web/src/features/search-bar/components/SearchComposer.tsx
@@ -61,9 +61,10 @@ import {
optionDomId,
} from "@/src/features/search-bar/components/presentation";
import {
- COMPOSER_SURFACE_CLASSES,
- COMPOSER_TEXT_CLASSES,
-} from "@/src/features/search-bar/components/composer-chrome";
+ ComposerSurface,
+ type ComposerSize,
+ ComposerText,
+} from "@/src/features/search-bar/components/ComposerSurface";
const LISTBOX_ID = "search-bar-listbox";
// Word joiners (shared with ComposerTokens) give the DOM caret boundaries
@@ -327,8 +328,11 @@ export function SearchComposer({
fieldReason,
freeTextReason,
registry = EVENTS_FIELD_REGISTRY,
+ size = "default",
}: {
projectId?: string;
+ /** `large` on full-page lists; embedded toolbars keep the default. */
+ size?: ComposerSize;
/** Observed facet values for value suggestions; undefined = loading. */
observed: ObservedOptions | undefined;
/** Columns whose lazy fetch terminally errored — settle the value-stage
@@ -1401,159 +1405,149 @@ export function SearchComposer({
role="search"
className="ph-no-capture relative w-full"
>
- <div
- data-testid="search-bar-surface"
- data-composer-text={draft}
- onMouseLeave={() => setHoveredTokenId(null)}
- className={cn(
- // Prominent primary control. Block (not flex) so inline pills never
- // break across a wrap. Balanced padding: a small, even gutter on all
- // sides (the left no longer dwarfs the inter-pill gap and top), py
- // centers a single line near min-h-8 and the box grows when wrapped.
- // Right gutter keeps the last token clear of the top-right control:
- // the "Ask AI" button (pr-20), or the error icon (pr-8).
- // Box + text metrics are shared with the preview surface
- // (composer-chrome.ts) so the overlay renders pixel-identical.
- COMPOSER_SURFACE_CLASSES,
+ <ComposerSurface
+ size={size}
+ interactive
+ error={showGlobalDiagnostics}
+ trailing={
onActivateAi !== undefined && !showGlobalDiagnostics
- ? "pr-20"
- : "pr-8",
- "focus-within:ring-ring focus-within:ring-1",
- showGlobalDiagnostics &&
- "border-destructive focus-within:ring-destructive/40",
- )}
+ ? "button"
+ : "icon"
+ }
>
- {draft.length === 0 && (
- <div
- className={cn(
- // Bound the right edge (not just pr-*) so `truncate` has a width
- // to clip against — otherwise the placeholder grows to its full
- // text width and runs under the top-right "Ask AI" button. The
- // reserved gap matches the surface's pr-20/pr-8.
- "text-muted-foreground pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 truncate font-mono text-xs",
- // Mirror the surface's right reservation exactly: the "Ask AI"
- // button (right-20) is hidden while diagnostics show, when the
- // error icon takes over the top-right corner (right-8).
- onActivateAi !== undefined && !showGlobalDiagnostics
- ? "right-20"
- : "right-8",
- )}
- title={placeholder}
- >
- {placeholder}
- </div>
- )}
<div
- ref={rootRef}
- role="combobox"
- aria-label="Search"
- aria-expanded={plan !== null}
- aria-controls={plan !== null ? LISTBOX_ID : undefined}
- aria-autocomplete="list"
- aria-activedescendant={
- plan !== null && highlightedId !== null
- ? optionDomId(LISTBOX_ID, highlightedId)
- : undefined
- }
- aria-describedby={describedBy}
- contentEditable
- suppressContentEditableWarning
- // The query is code-like grammar, not prose: suppress every mobile-
- // keyboard mutation, not just the spellcheck squiggle. Without these,
- // iOS/Android default autocorrect + sentence-capitalization can
- // rewrite a partial token (`tps` → something) before commit.
- spellCheck={false}
- autoCorrect="off"
- autoCapitalize="none"
- inputMode="text"
- data-testid="search-bar-input"
- // leading-6 (not 7): WebKit/Safari sizes the text caret to the line
- // box, so a 28px (leading-7) line made the caret tower ~4px above/
- // below the ~24px pills ("too big"). 24px matches the pill height so
- // the caret aligns with the pills. Trade-off: tighter gap between
- // wrapped lines of pills (single-line is unaffected).
- className={cn(
- COMPOSER_TEXT_CLASSES,
- "ph-no-capture caret-[hsl(var(--foreground))] outline-none",
- )}
- onInput={(event) => {
- if (!(event.nativeEvent as InputEvent).isComposing) syncFromDom();
- }}
- onCompositionEnd={syncFromDom}
- // Disable drag-and-drop: an intra-bar drag fires deleteByDrag (which
- // the delete branch applies) without a matching insert, silently
- // dropping the dragged text. Drop is unsupported anyway; selection
- // and copy/cut/paste stay fully functional.
- onDragStart={(e) => e.preventDefault()}
- onKeyDown={onKeyDown}
- onCopy={onCopy}
- onCut={onCut}
- onPaste={onPaste}
- onFocus={onFocus}
- onBlur={onBlur}
- onClick={onRootClick}
- onMouseOver={onRootMouseOver}
+ data-testid="search-bar-surface"
+ data-composer-text={draft}
+ onMouseLeave={() => setHoveredTokenId(null)}
>
- <ComposerTokens
- key={tokensGeneration}
- draft={draft}
- showDiagnostics={showTokenDiagnostics}
- scoreTypes={scoreTypes}
- fieldReason={fieldReason}
- freeTextReason={freeTextReason}
- registry={registry}
- highlightedSegmentId={
- explanation !== null ? explainTargetId : errorTarget?.id
- }
- />
- </div>
- {/* "Ask AI" affordance — a plain button, always available so filters can
+ {draft.length === 0 && (
+ <div
+ className={cn(
+ // Bound the right edge (not just pr-*) so `truncate` has a width
+ // to clip against — otherwise the placeholder grows to its full
+ // text width and runs under the top-right "Ask AI" button. The
+ // reserved gap matches the surface's pr-20/pr-8.
+ "text-muted-foreground pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 truncate font-mono text-xs",
+ // Mirror the surface's right reservation exactly: the "Ask AI"
+ // button (right-20) is hidden while diagnostics show, when the
+ // error icon takes over the top-right corner (right-8).
+ onActivateAi !== undefined && !showGlobalDiagnostics
+ ? "right-20"
+ : "right-8",
+ )}
+ title={placeholder}
+ >
+ {placeholder}
+ </div>
+ )}
+ <ComposerText>
+ <div
+ ref={rootRef}
+ role="combobox"
+ aria-label="Search"
+ aria-expanded={plan !== null}
+ aria-controls={plan !== null ? LISTBOX_ID : undefined}
+ aria-autocomplete="list"
+ aria-activedescendant={
+ plan !== null && highlightedId !== null
+ ? optionDomId(LISTBOX_ID, highlightedId)
+ : undefined
+ }
+ aria-describedby={describedBy}
+ contentEditable
+ suppressContentEditableWarning
+ // The query is code-like grammar, not prose: suppress every mobile-
+ // keyboard mutation, not just the spellcheck squiggle. Without these,
+ // iOS/Android default autocorrect + sentence-capitalization can
+ // rewrite a partial token (`tps` → something) before commit.
+ spellCheck={false}
+ autoCorrect="off"
+ autoCapitalize="none"
+ inputMode="text"
+ data-testid="search-bar-input"
+ className="ph-no-capture caret-[hsl(var(--foreground))] outline-none"
+ onInput={(event) => {
+ if (!(event.nativeEvent as InputEvent).isComposing)
+ syncFromDom();
+ }}
+ onCompositionEnd={syncFromDom}
+ // Disable drag-and-drop: an intra-bar drag fires deleteByDrag (which
+ // the delete branch applies) without a matching insert, silently
+ // dropping the dragged text. Drop is unsupported anyway; selection
+ // and copy/cut/paste stay fully functional.
+ onDragStart={(e) => e.preventDefault()}
+ onKeyDown={onKeyDown}
+ onCopy={onCopy}
+ onCut={onCut}
+ onPaste={onPaste}
+ onFocus={onFocus}
+ onBlur={onBlur}
+ onClick={onRootClick}
+ onMouseOver={onRootMouseOver}
+ >
+ <ComposerTokens
+ key={tokensGeneration}
+ draft={draft}
+ showDiagnostics={showTokenDiagnostics}
+ scoreTypes={scoreTypes}
+ fieldReason={fieldReason}
+ freeTextReason={freeTextReason}
+ registry={registry}
+ highlightedSegmentId={
+ explanation !== null ? explainTargetId : errorTarget?.id
+ }
+ />
+ </div>
+ </ComposerText>
+ {/* "Ask AI" affordance — a plain button, always available so filters can
be built from scratch OR refined. Placed AFTER the field in the DOM so
forward Tab moves from the field onto this button (not past the bar).
Deliberately NOT a Tab shortcut: while typing, Tab belongs to
autocomplete navigation. Hidden while the error icon occupies the
corner. bg-background keeps it legible; onMouseDown preventDefault so a
click doesn't blur the editor first. */}
- {onActivateAi !== undefined && !showGlobalDiagnostics && (
- <button
- type="button"
- data-testid="search-bar-ask-ai"
- aria-label="Ask AI to build or refine filters"
- title={
- draft.trim().length === 0
- ? "Describe filters in natural language"
- : "Refine these filters with AI"
- }
- onMouseDown={(event) => event.preventDefault()}
- onClick={(event) => {
- event.stopPropagation();
- onActivateAi();
- }}
- className={cn(
- "absolute top-0.75 right-2 z-20 inline-flex items-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5",
- "bg-background text-muted-foreground font-sans text-xs",
- "hover:text-foreground transition-colors",
- // Match the app's focus ring (ring-ring) instead of the browser's
- // default blue outline, like the shared Button used elsewhere.
- "ring-offset-background focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden",
- )}
- >
- <WandSparkles className="icon-base" aria-hidden="true" />
- <span>Ask AI</span>
- </button>
- )}
- {/* Bar-local overlay stacking ladder: token text (base) < remove-X
+ {onActivateAi !== undefined && !showGlobalDiagnostics && (
+ <button
+ type="button"
+ data-testid="search-bar-ask-ai"
+ aria-label="Ask AI to build or refine filters"
+ title={
+ draft.trim().length === 0
+ ? "Describe filters in natural language"
+ : "Refine these filters with AI"
+ }
+ onMouseDown={(event) => event.preventDefault()}
+ onClick={(event) => {
+ event.stopPropagation();
+ onActivateAi();
+ }}
+ className={cn(
+ "absolute right-2 z-20 inline-flex items-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5",
+ size === "large" ? "top-1.25" : "top-0.75",
+ "bg-background text-muted-foreground font-sans text-xs",
+ "hover:text-foreground transition-colors",
+ // Match the app's focus ring (ring-ring) instead of the browser's
+ // default blue outline, like the shared Button used elsewhere.
+ "ring-offset-background focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden",
+ )}
+ >
+ <WandSparkles className="icon-base" aria-hidden="true" />
+ <span>Ask AI</span>
+ </button>
+ )}
+ {/* Bar-local overlay stacking ladder: token text (base) < remove-X
(z-20). The autocomplete and token tooltip both render through app
overlay layers so they escape clipped table, panel, and dialog
ancestors. */}
- {removeTarget !== null && removePosition !== null && (
- <RemoveTokenButton
- segment={removeTarget}
- position={removePosition}
- onRemove={removeSegment}
- />
- )}
- </div>
+ {removeTarget !== null && removePosition !== null && (
+ <RemoveTokenButton
+ segment={removeTarget}
+ position={removePosition}
+ onRemove={removeSegment}
+ />
+ )}
+ </div>
+ </ComposerSurface>
{showGlobalDiagnostics && (
<div className="absolute top-1/2 right-2 flex -translate-y-1/2 items-center gap-1">
diff --git a/web/src/features/search-bar/components/TableSearchBar.tsx b/web/src/features/search-bar/components/TableSearchBar.tsx
index 59db429e9d..076ba2b161 100644
--- a/web/src/features/search-bar/components/TableSearchBar.tsx
+++ b/web/src/features/search-bar/components/TableSearchBar.tsx
@@ -2,6 +2,7 @@ import type { FilterState, TracingSearchType } from "@langfuse/shared";
import { EventsSearchBarRow } from "./EventsSearchBarRow";
import { useEventsSearchBar } from "../hooks/useEventsSearchBar";
import { DEFAULT_SEARCH_TYPE } from "../lib/commit";
+import type { ComposerSize } from "./ComposerSurface";
import type { FieldRegistry } from "../lib/fields";
import type { ObservedOptions } from "../lib/observed-options";
@@ -19,6 +20,7 @@ export function TableSearchBar({
onRequestColumns,
erroredColumns,
inset = false,
+ size = "default",
}: {
projectId?: string;
tableName: string;
@@ -36,6 +38,8 @@ export function TableSearchBar({
onRequestColumns?: (columns: readonly string[]) => void;
erroredColumns?: ReadonlySet<string>;
inset?: boolean;
+ /** `large` on full-page lists; embedded toolbars keep the default. */
+ size?: ComposerSize;
}) {
// The host owns the applied query and scope; the bar edits both together.
const { store, commit, applyFilters } = useEventsSearchBar({
@@ -69,6 +73,7 @@ export function TableSearchBar({
onApplyFilters={applyFilters}
onRequestColumns={onRequestColumns}
erroredColumns={erroredColumns}
+ size={size}
/>
</div>
</div>
diff --git a/web/src/features/search-bar/components/composer-chrome.ts b/web/src/features/search-bar/components/composer-chrome.ts
deleted file mode 100644
index fbebec1c8b..0000000000
--- a/web/src/features/search-bar/components/composer-chrome.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-// Shared chrome between the real composer (SearchComposer) and the read-only
-// preview surface (ComposerWithPreview). Both must render pixel-identical —
-// the preview overlays the editor in the same grid cell — so the box and the
-// text metrics live here instead of being duplicated and drifting apart.
-
-/** The bar's box: border, background, radius, padding, min height. */
-export const COMPOSER_SURFACE_CLASSES =
- "border-input bg-background relative min-h-8 rounded-md border px-2 py-0.75";
-
-/** The query text metrics: mono font, pill-matched line height, wrapping. */
-export const COMPOSER_TEXT_CLASSES =
- "min-h-6 font-mono text-xs leading-6 break-words whitespace-pre-wrap";
diff --git a/web/src/features/search-bar/index.ts b/web/src/features/search-bar/index.ts
index bdc9c7f4cc..fe61f37b63 100644
--- a/web/src/features/search-bar/index.ts
+++ b/web/src/features/search-bar/index.ts
@@ -9,9 +9,10 @@ export { ComposerTokens } from "@/src/features/search-bar/components/ComposerTok
export { EventsSearchBarRow } from "@/src/features/search-bar/components/EventsSearchBarRow";
export { TableSearchBar } from "@/src/features/search-bar/components/TableSearchBar";
export {
- COMPOSER_SURFACE_CLASSES,
- COMPOSER_TEXT_CLASSES,
-} from "@/src/features/search-bar/components/composer-chrome";
+ type ComposerSize,
+ ComposerSurface,
+ ComposerText,
+} from "@/src/features/search-bar/components/ComposerSurface";
export { useEventsSearchBar } from "@/src/features/search-bar/hooks/useEventsSearchBar";
export { useSearchBarEnabled } from "@/src/features/search-bar/hooks/useSearchBarEnabled";
export { useFullTextSearch } from "@/src/features/search-bar/hooks/useFullTextSearch";
diff --git a/web/src/features/sessions/SessionsTable.tsx b/web/src/features/sessions/SessionsTable.tsx
index a81f268954..bf42f15dd7 100644
--- a/web/src/features/sessions/SessionsTable.tsx
+++ b/web/src/features/sessions/SessionsTable.tsx
@@ -849,6 +849,7 @@ export default function SessionsTable({
<StickySearchableTableFilterLayout
search={
<TableSearchBar
+ size={showControlsInPageHeader ? "large" : "default"}
key={`${viewControllers.filterEditorResetKey}-${queryFilter.draftResetKey}`}
isV4={isV4}
filterState={queryFilter.searchBarFilterState}
diff --git a/web/src/features/skills/components/SkillsPage.tsx b/web/src/features/skills/components/SkillsPage.tsx
index 2f6fe468b5..a2c9ef1713 100644
--- a/web/src/features/skills/components/SkillsPage.tsx
+++ b/web/src/features/skills/components/SkillsPage.tsx
@@ -214,6 +214,7 @@ function SkillsList({
</div>
<div className="min-w-0 flex-1">
<TableSearchBar
+ size="large"
key={`${projectId}:${queryFilter.draftResetKey}`}
projectId={projectId}
tableName="skills"
diff --git a/web/src/features/traces/TracesTable.tsx b/web/src/features/traces/TracesTable.tsx
index 46c574e82a..b1a29f00fc 100644
--- a/web/src/features/traces/TracesTable.tsx
+++ b/web/src/features/traces/TracesTable.tsx
@@ -1442,6 +1442,7 @@ function TracesTableInternal({
search={
hideControls ? null : (
<TableSearchBar
+ size={showControlsInPageHeader ? "large" : "default"}
key={`${viewControllers.filterEditorResetKey}-${queryFilter.draftResetKey}`}
projectId={projectId}
tableName={tracesFilterConfig.tableName}
diff --git a/web/src/features/tracing-tables/observations/ObservationsTable.tsx b/web/src/features/tracing-tables/observations/ObservationsTable.tsx
index d13d4b63b6..6f803a249e 100644
--- a/web/src/features/tracing-tables/observations/ObservationsTable.tsx
+++ b/web/src/features/tracing-tables/observations/ObservationsTable.tsx
@@ -1392,6 +1392,7 @@ export default function ObservationsTable({
search={
!hideControls ? (
<TableSearchBar
+ size={showControlsInPageHeader ? "large" : "default"}
key={`${viewControllers.filterEditorResetKey}-${queryFilter.draftResetKey}`}
projectId={projectId}
tableName={observationsFilterConfig.tableName}
diff --git a/web/src/features/users/UsersTable.tsx b/web/src/features/users/UsersTable.tsx
index db2a575f85..0fe82830ca 100644
--- a/web/src/features/users/UsersTable.tsx
+++ b/web/src/features/users/UsersTable.tsx
@@ -527,6 +527,7 @@ export function UsersTable({
<StickySearchableTableFilterLayout
search={
<TableSearchBar
+ size={showControlsInPageHeader ? "large" : "default"}
key={`${viewControllers.filterEditorResetKey}-${queryFilter.draftResetKey}`}
isV4={isV4}
filterState={queryFilter.searchBarFilterState}