# Segmented Button Component
Segmented button groups combine buttons into a single control. It can present options, switch views, or sort items.
## Usage {#usage}
Import the component:
```js
import 'mdui/components/segmented-button-group.js';
import 'mdui/components/segmented-button.js';
```
Import the TypeScript type:
```ts
import type { SegmentedButtonGroup } from 'mdui/components/segmented-button-group.js';
import type { SegmentedButton } from 'mdui/components/segmented-button.js';
```
Example:
```html,example,playgroundId=344
Day
Week
Month
```
## Examples {#examples}
### Full Width {#example-full-width}
To make the component take up the full width of its container, add the `full-width` attribute to the `` component.
```html,example,expandable,playgroundId=345
Day
Week
Month
```
### Single Selection {#example-selects-single}
To enable single selection mode, set the `selects` attribute of the `` component to `single`. In this mode, the `value` property of `` reflects the `value` property of the currently selected ``.
```html,example,expandable,playgroundId=346
Day
Week
Month
Day
Week
Month
```
### Multiple Selection {#example-selects-multiple}
To enable multiple selection mode, set the `selects` attribute of the `` component to `multiple`. In this mode, the `value` property of `` is an array consisting of the `value` properties of the currently selected `` components.
When multiple selection is enabled, the `value` property of `` is an array and can only be accessed and updated in JavaScript.
```html,example,expandable,playgroundId=347
Day
Week
Month
Day
Week
Month
```
### Icons {#example-icon}
To add Material Icons on the left and right sides of the button, use the `icon` and `end-icon` attributes on the `` element. Alternatively, use the `icon` and `end-icon` slots to add elements on the left and right sides of the button.
```html,example,expandable,playgroundId=348
Day
Week
Month
```
To set the Material Icon for the selected state, use the `selected-icon` attribute on the `` element. Alternatively, use the `selected-icon` slot.
```html,example,expandable,playgroundId=349
Day
Week
```
### Link {#example-link}
To turn the button into a link, use the `href` attribute on the `` component. The `download`, `target`, and `rel` attributes are available for link-related functionality.
```html,example,expandable,playgroundId=350
Link
Week
Month
```
### Disabled and Loading States {#example-disabled}
To disable the entire segmented button group, add the `disabled` attribute to the `` element.
```html,example,expandable,playgroundId=351
Day
Week
Month
```
To disable specific buttons, add the `disabled` attribute to the `` element. To make a button enter the loading state, add the `loading` attribute.
```html,example,expandable,playgroundId=352
Day
Week
Month
Year
```