: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { Meta } from '@storybook/react'
import { useMountedLogic } from 'kea'
import { useState } from 'react'
import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'
import { taxonomicFilterMocksDecorator } from 'lib/components/TaxonomicFilter/__mocks__/taxonomicFilterMocksDecorator'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { cohortsModel } from '~/models/cohortsModel'
import { TaxonomicPopover, TaxonomicPopoverProps, TaxonomicStringPopover } from './TaxonomicPopover'
const meta: Meta<TaxonomicPopoverProps<any>> = {
title: 'Filters/TaxonomicPopover',
component: TaxonomicPopover as any,
decorators: [taxonomicFilterMocksDecorator],
}
export default meta
export function TaxonomicStringPopoverOneCategory(): JSX.Element {
useMountedLogic(cohortsModel)
const [value, setValue] = useState<string | undefined>('$browser')
return (
<TaxonomicStringPopover
groupType={TaxonomicFilterGroupType.PersonProperties}
value={value}
onChange={setValue}
renderValue={(v) => <PropertyKeyInfo value={v} type={TaxonomicFilterGroupType.PersonProperties} />}
/>
)
}
export function MultipleCategories(): JSX.Element {
useMountedLogic(cohortsModel)
const [value, setValue] = useState<string | number | null | undefined>(undefined)
const [group, setGroup] = useState(TaxonomicFilterGroupType.PersonProperties)
return (
<TaxonomicPopover
groupType={group}
value={value}
onChange={(v, g) => {
setValue(v)
setGroup(g)
}}
groupTypes={[
TaxonomicFilterGroupType.EventProperties,
TaxonomicFilterGroupType.PersonProperties,
TaxonomicFilterGroupType.EventFeatureFlags,
TaxonomicFilterGroupType.Cohorts,
]}
/>
)
}