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.

889 B
Raw Blame
import { useId } from 'react'

import { Field, Switch } from '@posthog/quill'

import type { ChartOptionSwitchProps } from './ChartOptionSwitch'
import { QuillChartOptionLabel } from './QuillChartOptionLabel'

export function QuillChartOptionSwitch({
    label,
    info,
    checked,
    onChange,
    disabledReason,
    'data-attr': dataAttr,
}: ChartOptionSwitchProps): JSX.Element {
    const id = useId()

    return (
        <Field orientation="horizontal" className="min-h-6 justify-between">
            <QuillChartOptionLabel htmlFor={id} label={label} info={info} />
            <Switch
                id={id}
                size="sm"
                checked={checked}
                onCheckedChange={(next: boolean) => onChange(next)}
                disabledReason={disabledReason || undefined}
                data-attr={dataAttr}
            />
        </Field>
    )
}