@@ -98,3 +98,124 @@ The button group component is inherently horizontal and cannot be wrapped or sta
9898Alternatively, actions can be collapsed under a menu or replaced with a [ select] ( ../forms-inputs/select.md ) ,
9999[ radio] ( ../forms-inputs/radio.md ) , or [ checkboxes] ( ../forms-inputs/checkbox.md ) component,
100100depending on the interaction type.
101+
102+ ## Code ---
103+
104+ Button groups are created using CSS classes. The button group component is CSS-only and does not require any Angular components.
105+
106+ ### Usage
107+
108+ Wrap buttons in a ` btn-group ` container with the appropriate ` role ` and ` aria-label ` attributes for accessibility.
109+
110+ ``` html
111+ <div class =" btn-group" role =" group" aria-label =" Basic example" >
112+ <button type =" button" class =" btn btn-secondary" >Left</button >
113+ <button type =" button" class =" btn btn-secondary" >Middle</button >
114+ <button type =" button" class =" btn btn-secondary" >Right</button >
115+ </div >
116+ ```
117+
118+ ### Button group sizes
119+
120+ Button groups support three sizes: small (` btn-sm ` ), default, and large (` btn-lg ` ).
121+
122+ ``` html
123+ <!-- Large group -->
124+ <div class =" btn-group" role =" group" aria-label =" Large group" >
125+ <button type =" button" class =" btn btn-lg btn-secondary" >Large</button >
126+ <button type =" button" class =" btn btn-lg btn-secondary" >Group</button >
127+ </div >
128+
129+ <!-- Default group -->
130+ <div class =" btn-group" role =" group" aria-label =" Default group" >
131+ <button type =" button" class =" btn btn-secondary" >Default</button >
132+ <button type =" button" class =" btn btn-secondary" >Group</button >
133+ </div >
134+
135+ <!-- Small group -->
136+ <div class =" btn-group" role =" group" aria-label =" Small group" >
137+ <button type =" button" class =" btn btn-sm btn-secondary" >Small</button >
138+ <button type =" button" class =" btn btn-sm btn-secondary" >Group</button >
139+ </div >
140+ ```
141+
142+ ### Icon-only buttons
143+
144+ For icon-only button groups, use the ` btn-icon ` class along with appropriate ` aria-label ` attributes.
145+
146+ ``` html
147+ <div class =" btn-group" role =" group" aria-label =" Icon button group" >
148+ <button type =" button" class =" btn btn-icon btn-secondary" aria-label =" Edit" >
149+ <i class =" icon element-edit" ></i >
150+ </button >
151+ <button type =" button" class =" btn btn-icon btn-secondary" aria-label =" Copy" >
152+ <i class =" icon element-copy" ></i >
153+ </button >
154+ <button type =" button" class =" btn btn-icon btn-secondary" aria-label =" Delete" >
155+ <i class =" icon element-delete" ></i >
156+ </button >
157+ </div >
158+ ```
159+
160+ ### Action button group example
161+
162+ <si-docs-component example =" buttons/button-groups " height =" 400 " ></si-docs-component >
163+
164+ ### Split button
165+
166+ A split button combines a primary action with a dropdown menu of related options.
167+
168+ ``` html
169+ <div class =" btn-group" role =" group" aria-label =" Split button" >
170+ <button type =" button" class =" btn btn-primary" >
171+ <i class =" icon element-download" ></i >
172+ Download
173+ </button >
174+ <button
175+ type =" button"
176+ class =" btn btn-primary btn-icon dropdown-toggle"
177+ aria-label =" Dropdown toggle"
178+ [cdkMenuTriggerFor] =" dropdownMenu"
179+ >
180+ <i class =" dropdown-caret icon element-down-2" ></i >
181+ </button >
182+ </div >
183+ ```
184+
185+ <si-docs-component example =" buttons/split-button " height =" 300 " ></si-docs-component >
186+
187+ ### Selection button
188+
189+ For selection-based button groups that represent different states or views, use radio buttons or checkboxes with button styling.
190+
191+ ** Single-select:**
192+
193+ ``` html
194+ <div class =" btn-group" role =" group" aria-label =" View selection" >
195+ <input type =" radio" class =" btn-check" name =" view" id =" view-all" checked />
196+ <label class =" btn" for =" view-all" >All</label >
197+
198+ <input type =" radio" class =" btn-check" name =" view" id =" view-read" />
199+ <label class =" btn" for =" view-read" >Read</label >
200+
201+ <input type =" radio" class =" btn-check" name =" view" id =" view-unread" />
202+ <label class =" btn" for =" view-unread" >Unread</label >
203+ </div >
204+ ```
205+
206+ ** Multi-select:**
207+
208+ ``` html
209+ <div class =" btn-group" role =" group" aria-label =" Filter options" >
210+ <input type =" checkbox" class =" btn-check" id =" filter-temp" />
211+ <label class =" btn" for =" filter-temp" >Temperature</label >
212+
213+ <input type =" checkbox" class =" btn-check" id =" filter-pressure" />
214+ <label class =" btn" for =" filter-pressure" >Pressure</label >
215+
216+ <input type =" checkbox" class =" btn-check" id =" filter-voltage" />
217+ <label class =" btn" for =" filter-voltage" >Voltage</label >
218+ </div >
219+ ```
220+
221+ <si-docs-component example =" buttons/selection-buttons " height =" 350 " ></si-docs-component >
0 commit comments