Base

  • Colors
  • Icons
  • Logos
  • Shadows and Elevations
  • Spacing
  • Typography

Components

  • Accordion
  • Avatars
  • Badges
  • Buttons
  • Cards
  • Character Counter
  • Device Type Icons
  • Draggables
  • Dropdowns
  • Droppables
  • Expandable image
  • Filters
  • Gallery card
  • Icon Button
  • Indicators
  • Lightbox image
  • Lists
  • Loading
  • Messages
  • Pictogram
  • Poster Play
  • Progress bar
  • QR Code
  • Rating stars
  • Row Selector
  • Segmented Controls
  • Sentiment
  • Split View
  • Tables
  • Tags
  • Tester vitals
  • Toggle button
  • Typeahead

Form

  • Checkbox
  • Combobox
  • Form Rule
  • Hint
  • Input
  • Input Title
  • Label
  • Multi-select List
  • Search
  • Select
  • Single-select List
  • Sliders
  • Switch
  • Text Area

Layout

  • Containers
  • Layers
  • Layout
  • Split Layout
  • Wrappers

Navigation

  • Context Switcher
  • Nav bar
  • Navigation
  • Pagination
  • Sidebar Navigation
  • Step Navigation
  • Tabs

Overlay

  • Banners
  • Bulk Selector
  • Modals
  • Popovers
  • Toast
  • Tooltips
  • User Notifications

Patterns

  • Full Page Message
  • Question card & Group Questions Container

Visualizations

  • Data Colors

Toggle button

Default

Movies
Expand Copy
<tk-toggle-button>
  <div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>

Description

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.

Using within a framework:

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 }]'.

Using without a framework:

This requires JS to set the options Prop, otherwise it’ll treat the value as a string. Read More →

Inline

Movies
Expand Copy
<tk-toggle-button inline>
  <div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>

Description

By default, the options are stacked. Set the inline prop to make the options inline.

Fill container

Movies
Expand Copy
<tk-toggle-button fill-container>
  <div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>

Description

By default, options are as wide as their content. To have them grow to the width of their container, set fill-container.

Inline: fill container

Movies
Expand Copy
<tk-toggle-button inline fill-container>
  <div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>

Description

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.

Selected

Movies
Expand Copy
<tk-toggle-button selected="willow">
  <div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>

Description

Pass the selected prop with the value of the option to set it to selected (:checked) by default.

Size: large

Movies
Expand Copy
<tk-toggle-button size="large">
  <div slot="legend" class="mb-2x">Movies</div>
</tk-toggle-button>

Description

To render the toggle button in a large size, pass the size property.

Error message

Example error message
Movies
Expand Copy
<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>

tk-toggle-button

Properties

Property Attribute Description Type Default
inline inline Controls the orientation of the options. If set to true, the options will be displayed horizontally. Otherwise, they will be stacked. boolean false
options An array of choices to render. This must be an array of objects of the ToggleButtonOption type. An optional “disabled” key can be set within the object to render an option as disabled. An optional “ariaLabel” key can be set within the object to specify a “aria-label” value. ToggleButtonOption[] undefined
required required Sets the HTML attribute of required. boolean false
selected selected A value that, if matches value in the options, will preselect that option. string null
size size Controls the size of the button "large" | "medium" 'medium'

Events

Event Description Type
checked The value of the currently selected option. CustomEvent<string>