|
1 | 1 | --- |
2 | 2 | layout: docs |
3 | | -title: ButtonGroup |
| 3 | +title: Button group |
4 | 4 | description: Group a series of buttons together on a single line with the button group, and super-power them with JavaScript. |
5 | 5 | group: Components |
6 | 6 | --- |
7 | 7 |
|
8 | 8 | import { ButtonGroup, Toolbar } from 'boot-cell/source/Form/ButtonGroup'; |
9 | 9 | import { Button } from 'boot-cell/source/Form/Button'; |
| 10 | +import { InputGroup } from 'boot-cell/source/Form/InputGroup'; |
10 | 11 | import { DropMenu } from 'boot-cell/source/Navigator/DropMenu'; |
11 | 12 |
|
12 | 13 | import { Example } from '../../../source/component/Example'; |
@@ -96,6 +97,82 @@ render( |
96 | 97 | ); |
97 | 98 | ``` |
98 | 99 |
|
| 100 | +Feel free to mix input groups with button groups in your toolbars. Similar to the example above, |
| 101 | +you’ll likely need some utilities though to space things properly. |
| 102 | + |
| 103 | +<Example> |
| 104 | + <Toolbar aria-label="Toolbar with button groups"> |
| 105 | + <ButtonGroup className="mr-2" aria-label="First group"> |
| 106 | + <Button kind="secondary">1</Button> |
| 107 | + <Button kind="secondary">2</Button> |
| 108 | + <Button kind="secondary">3</Button> |
| 109 | + <Button kind="secondary">4</Button> |
| 110 | + </ButtonGroup> |
| 111 | + <InputGroup |
| 112 | + placeholder="Input group example" |
| 113 | + aria-label="Input group example" |
| 114 | + prepend="@" |
| 115 | + /> |
| 116 | + </Toolbar> |
| 117 | + <Toolbar |
| 118 | + className="justify-content-between" |
| 119 | + aria-label="Toolbar with button groups" |
| 120 | + > |
| 121 | + <ButtonGroup className="mr-2" aria-label="First group"> |
| 122 | + <Button kind="secondary">1</Button> |
| 123 | + <Button kind="secondary">2</Button> |
| 124 | + <Button kind="secondary">3</Button> |
| 125 | + <Button kind="secondary">4</Button> |
| 126 | + </ButtonGroup> |
| 127 | + <InputGroup |
| 128 | + placeholder="Input group example" |
| 129 | + aria-label="Input group example" |
| 130 | + prepend="@" |
| 131 | + /> |
| 132 | + </Toolbar> |
| 133 | +</Example> |
| 134 | + |
| 135 | +```TSX |
| 136 | +import { render, createCell, Fragment } from 'web-cell'; |
| 137 | +import { ButtonGroup, Toolbar } from 'boot-cell/source/Form/ButtonGroup'; |
| 138 | +import { Button } from 'boot-cell/source/Form/Button'; |
| 139 | +import { InputGroup } from 'boot-cell/source/Form/InputGroup'; |
| 140 | + |
| 141 | +render( |
| 142 | + <Fragment> |
| 143 | + <Toolbar aria-label="Toolbar with button groups"> |
| 144 | + <ButtonGroup className="mr-2" aria-label="First group"> |
| 145 | + <Button kind="secondary">1</Button> |
| 146 | + <Button kind="secondary">2</Button> |
| 147 | + <Button kind="secondary">3</Button> |
| 148 | + <Button kind="secondary">4</Button> |
| 149 | + </ButtonGroup> |
| 150 | + <InputGroup |
| 151 | + placeholder="Input group example" |
| 152 | + aria-label="Input group example" |
| 153 | + prepend="@" |
| 154 | + /> |
| 155 | + </Toolbar> |
| 156 | + <Toolbar |
| 157 | + className="justify-content-between" |
| 158 | + aria-label="Toolbar with button groups" |
| 159 | + > |
| 160 | + <ButtonGroup className="mr-2" aria-label="First group"> |
| 161 | + <Button kind="secondary">1</Button> |
| 162 | + <Button kind="secondary">2</Button> |
| 163 | + <Button kind="secondary">3</Button> |
| 164 | + <Button kind="secondary">4</Button> |
| 165 | + </ButtonGroup> |
| 166 | + <InputGroup |
| 167 | + placeholder="Input group example" |
| 168 | + aria-label="Input group example" |
| 169 | + prepend="@" |
| 170 | + /> |
| 171 | + </Toolbar> |
| 172 | + </Fragment> |
| 173 | +); |
| 174 | +``` |
| 175 | + |
99 | 176 | ## Sizing |
100 | 177 |
|
101 | 178 | Instead of applying button sizing properties to every button in a group, |
|
0 commit comments