Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(replay-vision): add tag filter search (#70337)

Paul D'Ambra231c4c535ebe
diff --git a/products/replay_vision/frontend/components/FilterPill.tsx b/products/replay_vision/frontend/components/FilterPill.tsx
index e1c9b74b951f..90dc3d8dd299 100644
--- a/products/replay_vision/frontend/components/FilterPill.tsx
+++ b/products/replay_vision/frontend/components/FilterPill.tsx
@@ -1,16 +1,24 @@
-import { LemonButton, LemonButtonWithDropdown, LemonCheckbox } from '@posthog/lemon-ui'
+import { useState } from 'react'
+
+import { LemonButton, LemonButtonWithDropdown, LemonCheckbox, LemonInput } from '@posthog/lemon-ui'
export function FilterPill<T extends string>({
label,
options,
value,
onChange,
+ searchable = false,
}: {
label: string
options: { value: T; label: string }[]
value: T[]
onChange: (next: T[]) => void
+ searchable?: boolean
}): JSX.Element {
+ const [searchTerm, setSearchTerm] = useState('')
+ const filteredOptions = searchTerm
+ ? options.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()))
+ : options
const toggle = (v: T): void => {
onChange(value.includes(v) ? value.filter((x) => x !== v) : [...value, v])
}
@@ -20,12 +28,36 @@ export function FilterPill<T extends string>({
size="small"
dropdown={{
closeOnClickInside: false,
- overlay: options.map((opt) => (
- <LemonButton key={opt.value} fullWidth onClick={() => toggle(opt.value)}>
- <LemonCheckbox checked={value.includes(opt.value)} className="pointer-events-none mr-2" />
- {opt.label}
- </LemonButton>
- )),
+ onVisibilityChange: (visible) => {
+ if (!visible) {
+ setSearchTerm('')
+ }
+ },
+ overlay: (
+ <>
+ {searchable && (
+ <LemonInput
+ type="search"
+ size="small"
+ placeholder="Search tags"
+ autoFocus
+ fullWidth
+ value={searchTerm}
+ onChange={setSearchTerm}
+ className="mb-1"
+ />
+ )}
+ {filteredOptions.map((opt) => (
+ <LemonButton key={opt.value} fullWidth onClick={() => toggle(opt.value)}>
+ <LemonCheckbox
+ checked={value.includes(opt.value)}
+ className="pointer-events-none mr-2"
+ />
+ {opt.label}
+ </LemonButton>
+ ))}
+ </>
+ ),
}}
>
{value.length > 0 ? `${label} (${value.length})` : label}
diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx
index 26d43e137072..fc5d0a975dff 100644
--- a/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx
@@ -277,6 +277,7 @@ export function ScannerObservationsTable({ scannerId }: { scannerId: string }):
options={tagFilterOptions}
value={observationTagFilter}
onChange={setObservationTagFilter}
+ searchable
/>
)}
<LemonButton