KANTO DS v1.12.0
Customise

Theme

Accent

Font

Corners

Density

Text size

Reset to Kanto
Navigation

kt-toggle-button

GitHub Copy link

A button that stays pressed.

Preview

Secondary Outline

A button that stays pressed.

<kt-toggle-button icon="bold" label="Bold"></kt-toggle-button> <kt-toggle-button variant="outline" value="draft">Draft</kt-toggle-button>

aria-pressed, not aria-checked: this is a control holding a state, not one option among several. When they are options among several and only one may be active, reach for <kt-segmented-control> or <kt-tabs> — they carry the right semantics and the right keyboard model.

To draw several as one bar, wrap them in <kt-toggle-button-group>. Inside a group the button becomes controlled: it stops flipping itself and stops emitting, and the group drives it.

Variants

VariantResting
primaryRaised surface; solid indigo when pressed
secondaryFlat; soft indigo tint when pressed
outlineBordered, transparent; tinted when pressed

API

PropertyAttributeTypeDefault
selectedselectedbooleanfalse
disableddisabledbooleanfalse
variantvariant'primary' | 'secondary' | 'outline''primary'
sizesize'small' | 'medium' | 'large''medium'
valuevaluestring''
iconiconstring''
iconPositionicon-position'left' | 'right''left'
labellabelstring''
EventDetail
kt-change{ selected, value } — not fired inside a group
SlotDescription
defaultThe button label
PartDescription
buttonThe native <button>