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.

1.1 KB
Raw Blame
import { LemonSelect, LemonSelectProps } from '@posthog/lemon-ui'

import { CurrencyCode } from '~/queries/schema/schema-general'

import { OPTIONS_FOR_IMPORTANT_CURRENCIES, OPTIONS_FOR_OTHER_CURRENCIES } from './utils'

type CurrencyDropdownProps = {
    value: CurrencyCode | null
    onChange: (currency: CurrencyCode) => void
    size?: LemonSelectProps<any>['size']
    visible?: boolean // Useful for stories to display the dropdown content
    disabledReason?: string
}

export const CurrencyDropdown = ({
    value,
    onChange,
    visible,
    size,
    disabledReason,
}: CurrencyDropdownProps): JSX.Element => {
    return (
        <LemonSelect
            visible={visible}
            value={value}
            onChange={(newValue) => onChange(newValue as CurrencyCode)}
            options={[
                { options: OPTIONS_FOR_IMPORTANT_CURRENCIES, title: 'Most Popular' },
                { options: OPTIONS_FOR_OTHER_CURRENCIES, title: 'Other currencies' },
            ]}
            size={size}
            disabledReason={disabledReason}
            placeholder="Select currency"
        />
    )
}