|
10 | 10 | * governing permissions and limitations under the License.
|
11 | 11 | */
|
12 | 12 |
|
13 |
| -import {Checkbox, Link, ToggleButton, Toolbar, ToolbarProps} from 'react-aria-components'; |
| 13 | +import {Button, Checkbox, Group, Label, Link, ListBox, Popover, Select, SelectValue, Separator, ToggleButton, Toolbar, ToolbarProps} from 'react-aria-components'; |
14 | 14 | import {classNames} from '@react-spectrum/utils';
|
15 | 15 | import {Meta, StoryObj} from '@storybook/react';
|
| 16 | +import {MyListBoxItem} from './utils'; |
16 | 17 | import {Orientation} from 'react-stately';
|
17 | 18 | import React from 'react';
|
18 | 19 | import styles from '../example/index.css';
|
@@ -56,3 +57,51 @@ export const ToolbarExample: ToolbarStory = {
|
56 | 57 | );
|
57 | 58 | }
|
58 | 59 | };
|
| 60 | + |
| 61 | +export const SelectSupport: ToolbarStory = { |
| 62 | + args: { |
| 63 | + orientation: 'horizontal' as Orientation |
| 64 | + }, |
| 65 | + render: (props: ToolbarProps) => { |
| 66 | + return ( |
| 67 | + <Toolbar {...props} aria-label="Text formatting"> |
| 68 | + <Group aria-label="Style"> |
| 69 | + <ToggleButton aria-label="Bold"> |
| 70 | + <b>B</b> |
| 71 | + </ToggleButton> |
| 72 | + <ToggleButton aria-label="Italic"> |
| 73 | + <i>I</i> |
| 74 | + </ToggleButton> |
| 75 | + <ToggleButton aria-label="Underline"> |
| 76 | + <u>U</u> |
| 77 | + </ToggleButton> |
| 78 | + </Group> |
| 79 | + <Separator orientation="vertical" /> |
| 80 | + <Select> |
| 81 | + <Label>Favorite Animal</Label> |
| 82 | + <Button> |
| 83 | + <SelectValue /> |
| 84 | + <span aria-hidden="true">▼</span> |
| 85 | + </Button> |
| 86 | + <Popover> |
| 87 | + <ListBox> |
| 88 | + <MyListBoxItem>Aardvark</MyListBoxItem> |
| 89 | + <MyListBoxItem>Cat</MyListBoxItem> |
| 90 | + <MyListBoxItem>Dog</MyListBoxItem> |
| 91 | + <MyListBoxItem>Kangaroo</MyListBoxItem> |
| 92 | + <MyListBoxItem>Panda</MyListBoxItem> |
| 93 | + <MyListBoxItem>Snake</MyListBoxItem> |
| 94 | + </ListBox> |
| 95 | + </Popover> |
| 96 | + </Select> |
| 97 | + <Separator orientation="vertical" /> |
| 98 | + |
| 99 | + <Group aria-label="Clipboard"> |
| 100 | + <Button>Copy</Button> |
| 101 | + <Button>Paste</Button> |
| 102 | + <Button>Cut</Button> |
| 103 | + </Group> |
| 104 | + </Toolbar> |
| 105 | + ); |
| 106 | + } |
| 107 | +}; |
0 commit comments