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 { Meta } from '@storybook/react'
import { useState } from 'react'

import { LemonSlider, LemonSliderProps } from './LemonSlider'

const meta: Meta<LemonSliderProps> = {
    title: 'Lemon UI/Lemon Slider',
    component: LemonSlider,
    tags: ['autodocs'],
}
export default meta

export function Basic(): JSX.Element {
    const [value, setValue] = useState(42)

    return (
        <>
            <LemonSlider value={value} min={0} max={100} step={1} onChange={setValue} />
            <LemonSlider value={NaN} min={0} max={100} step={1} onChange={setValue} />
            {/* Values outside the min,max range are clamped */}
            <LemonSlider value={3000} min={0} max={100} step={1} onChange={setValue} />
            <LemonSlider value={-3000} min={0} max={100} step={1} onChange={setValue} />
        </>
    )
}

export function Disabled(): JSX.Element {
    const [value, setValue] = useState(42)

    return (
        <LemonSlider
            value={value}
            min={0}
            max={100}
            step={1}
            onChange={setValue}
            disabledReason="You don't have permission to change this value"
        />
    )
}