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

----

# TextButtonToggle

## Parameters

|parameter | type | required | options | default | description |
|:--- | :--- | :--- | :--- | :--- | :--- |
|selected | bool | no | true, false | false | |
|text | String | yes | | | |
|selectedText | String | yes | | | |
|iconName | String | yes | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons |
|selectedIconName | String | yes | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons |
|disabled | bool | no | true, false | false | Note: only works on button-tag, not on a-tag |
|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/text-button-toggle/text-button-toggle.njk' import TextButton %}

{{ TextButtonToggle({
  text: 'Spara artikel',
  selectedText: 'Sparad',
  iconName: 'bookmarked',
  selectedIconName: 'bookmark-filled'
})}}
```

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

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