Skip to main content

Toggle-Button

TkToggleButtonGroup is a component that allows you to create a group of toggle buttons.

import { TkToggleButtonGroup, TkToggleButton } from '@takeoff-ui/react'

Group Types

This demo visualizes the types of the toggle button group.

View Code

Group Direction

This demo visualizes the direction of the toggle button group.

View Code

Group Rounded

This demo visualizes the rounded of the toggle button group.

View Code

Button Variants

This demo visualizes the variants of the toggle button.

View Code

Button Types

This demo visualizes the types of the toggle button.

View Code

Button Sizes

This demo visualizes the sizes of the toggle button.

View Code

Button Disabled

This demo visualizes the disabled state of the toggle button.

View Code
<TkToggleButtonGroup value="1" type="basic" onTkChange={(e) => setValue(e.detail)}>
<TkToggleButton type="outlined" variant="neutral" key="1" value="1" icon="{ name: 'bolt', fill: true }" iconPosition="right" size="large" label="One"/>
<TkToggleButton type="outlined" variant="neutral" key="2" value="2" icon="{ name: 'bolt', fill: true }" iconPosition="right" size="large" label="Two"/>
<TkToggleButton type="outlined" variant="neutral" key="3" value="3" icon="{ name: 'bolt', fill: true }" iconPosition="right" size="large" label="Three"/>
</TkToggleButtonGroup >

Button Icon Position

This demo visualizes the icon position of the toggle button.

View Code

Toggle Button Group API

Props

NameTypeDefaultDescription
"horizontal", "vertical"'horizontal'The direction of the toggle button group.
booleanfalseThe value of the rounded toggle button group.
"basic", "divided", "light"'basic'The value type of the toggle button group.
anynullThe value of the selected toggle button.

Events

NameDescription
tk-changeEmitted when the selected value changes.

Toggle Button API

Props

NameTypeDefaultDescription
booleannullDisables the button, preventing user interaction.
IIconOptions, stringnullSpecifies a material icon name to be displayed.
"left", "right"'left'Defines the position of the icon.
string''Label text displayed inside the button.
booleannullMakes the button round with an icon-only style.
booleanfalseWhether the button is selected.
"base", "large", "small"'base'Sets size for the component.
"filled", "filled-light", "outlined", "raised", "text"'filled'The value of the type toggle button.
anynullThe value of the toggle button.
"neutral", "primary"'neutral'Determines the button's variant for different styles.

Events

NameDescription
tk-toggleEmitted when the toggle button is toggled.