- GitHub: [BonnierNews/dn-design-system/../web/src/components/button-toggle](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/button-toggle)
- Storybook: [Buttons > ButtonToggle](https://designsystem.dn.se/?path=/docs/basic-buttons-buttontoggle--docs)
- Storybook (Latest): [Buttons > ButtonToggle](https://designsystem-latest.dn.se/?path=/docs/basic-buttons-buttontoggle--docs)

----

# ButtonToggle

## Parameters

|parameter | type | required | options | default | description |
|:--- | :--- | :--- | :--- | :--- | :--- |
|selected | bool | no | true, false | false | |
|text | String | yes | | | |
|selectedText | String | yes | | | |
|disabled | bool | no | true, false | false | |
|variant | String | no | primary, secondary, brand | primary | Design variant |
|size| String | no | small, medium, large | medium | |
|fullWidth | bool | no | true, false | false | Button will be full width on both desktop and mobile |
|mobile.fullWidth | bool | no | true, false | false | Ex mobile: { fullWidth: true } |
|loading | bool | no | true, false | false | |
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|classNames | String | no | | | Ex. "my-special-class" |
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size

## Minimum requirement example

### Nunjucks

These are copy paste friendly examples to quickliy get started using a component.

```html
{% from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle.njk' import ButtonToggle %}

{{ ButtonToggle({
  text: 'Följ',
  selectedText: 'Följer',
  variant: 'brand',
  mobile: {
    fullWidth: true
  }
})}}
```

### SCSS
```scss
@use "@bonniernews/dn-design-system-web/components/button-toggle/button-toggle";
```

### Javascript

```javascript
import dsButtonToggle from '@bonniernews/dn-design-system-web/components/button/button-interactions.js'
const toggleElements = Array.from(document.getElementsByClassName("ds-btn--toggle"));
dsButtonToggle(toggleElements);
```
