This component is deprecated! Please use the new Toggle button instead.
Old component won’t get updates unless extraordinary circumstances require otherwise → reach out to our PO to discuss it.
New component should always be used unless extraordinary circumstances require otherwise → reach out to our PO to discuss it.
If you are looking to migrate this component and require help, reach out to the #ask-design-system Slack channel.
<tk-toggle-button>
<div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>tk-toggle-button renders a list of radio buttons based on a set of options. The options is an array of objects with label and value keys. It’s possible to use an HTML formatted label, using the htmlLabel property instead of label, which accepts HTML formatted code correctly processing strong and em and removing all the other tags.
Requires options Prop to be bound, so that it’s set as an object instead of a string. In Angular, this is: [options]='[{ your object }]'.
This requires JS to set the options Prop, otherwise it’ll treat the value as a string. Read More →
<tk-toggle-button inline>
<div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>By default, the options are stacked. Set the inline prop to make the options inline.
<tk-toggle-button fill-container>
<div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>By default, options are as wide as their content. To have them grow to the width of their container, set fill-container.
<tk-toggle-button inline fill-container>
<div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>By default, options are as wide as their content. To divide the available horizontal space inside a container equally over the options, set both inline and fill-container.
<tk-toggle-button selected="willow">
<div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>Pass the selected prop with the value of the option to set it to selected (:checked) by default.
<tk-toggle-button size="large">
<div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>To render the toggle button in a large size, pass the size property.
<tk-toggle-button size="large">
<div slot="error" class="l-inline-flex t-base">
<tk-icon aria-label="error" class="mr-2x mv-auto" name="alert" role="img" size="medium"></tk-icon>Example error message
</div>
<div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>