import {Fragment, useState} from 'react'; import {SegmentedControl} from 'sentry/components/segmentedControl'; import JSXNode from 'sentry/components/stories/jsxNode'; import Matrix from 'sentry/components/stories/matrix'; import SideBySide from 'sentry/components/stories/sideBySide'; import {IconStats} from 'sentry/icons'; import storyBook from 'sentry/stories/storyBook'; export default storyBook(SegmentedControl, story => { story('Default', () => (

By default will keep track of what is selected.

One Two Three
)); story('Controlled Value', () => { const [value, setValue] = useState('two'); return (

If you want to control the state of the tabs from outside, you can call{' '} {'useState()'} and set{' '} {' '} manually.

selected={value}

One Two Three
); }); story('Props', () => ( ( One Two Three )} selectedProps={['priority', 'size']} propMatrix={{ size: ['md' as const, 'sm' as const, 'xs' as const], priority: ['default' as const, 'primary' as const], }} /> )); story('SegmentedControl.Item', () => ( ( {showChild ? 'One' : undefined} {showChild ? 'Two' : undefined} {showChild ? 'Three' : undefined} )} selectedProps={['showChild', 'icon']} propMatrix={{ showChild: [true, false], icon: [undefined, ], }} /> ( One Two Three )} selectedProps={['tooltip', 'disabled']} propMatrix={{ tooltip: [undefined, 'Pick Me'], disabled: [false, true], }} /> ( One Two Three )} selectedProps={['disabled', 'priority']} propMatrix={{ disabled: [true, false], priority: ['default' as const, 'primary' as const], }} /> )); });