Debian Codegraph @

node/@patternfly/react-core/src/components/Slider/examples/SliderContinuous.tsx

raw
1 import { useState } from 'react';
2 import { Checkbox, Slider, SliderOnChangeEvent, Content } from '@patternfly/react-core';
3
4 export const SliderContinuous: React.FunctionComponent = () => {
5 const [hasTooltipOverThumb, setHasTooltipOverThumb] = useState(false);
6 const [value, setValue] = useState(50);
7 const [valueCustom, setValueCustom] = useState(50);
8
9 return (
10 <>
11 <Checkbox
12 id="thumb-has-tooltip"
13 label="hasTooltipOverThumb"
14 isChecked={hasTooltipOverThumb}
15 onChange={(_event: React.FormEvent<HTMLInputElement>, checked: boolean) => setHasTooltipOverThumb(checked)}
16 style={{ marginBottom: 20 }}
17 />
18 <Content component="h3">Slider Value is: {value}</Content>
19 <Slider
20 hasTooltipOverThumb={hasTooltipOverThumb}
21 value={value}
22 onChange={(_event: SliderOnChangeEvent, value: number) => setValue(value)}
23 />
24 <br />
25 <Content component="h3">Slider value is: {valueCustom}</Content>
26 <Slider
27 onChange={(_event: SliderOnChangeEvent, value: number) => setValueCustom(value)}
28 value={valueCustom}
29 areCustomStepsContinuous
30 hasTooltipOverThumb={hasTooltipOverThumb}
31 customSteps={[
32 { value: 0, label: '0%' },
33 { value: 100, label: '100%' }
34 ]}
35 />
36 </>
37 );
38 };