Skip to content

Switch

Toggle switch component. Built on Tabler form-switch, supports standard and large sizes, description text, row layout, and compact single mode.

Basic Usage

Show Code
vue
<TSwitch v-model="val" label="Wi-Fi" />

Two Sizes

Show Code
vue
<TSwitch v-model="val" label="Default" />
<TSwitch v-model="val" label="Large" size="lg" />

Description Text

Show Code
vue
<TSwitch v-model="val" label="Bluetooth" description="2 connected devices" />

Disabled State

Show Code
vue
<TSwitch v-model="val" label="Disabled" disabled />

Row Layout (Settings Style)

The row prop places the label on the left and the switch on the right, perfect for settings pages.

Show Code
vue
<TSwitch v-model="val" row label="Push Notifications" />
<TSwitch v-model="val" row label="Email" description="Daily digest" />

Single Switch (No Label)

When label, description, and the default slot are all omitted, the switch automatically uses form-check-single for a compact layout.

Show Code
vue
<TSwitch v-model="val" />
<TSwitch v-model="val" size="sm" />

API

Props

PropTypeDefaultDescription
v-modelbooleanfalseSwitch state
labelstringLabel text
descriptionstringDescription (muted small text)
size'sm' | 'md' | 'lg''md'Switch size (sm/md: default, lg: form-switch-lg)
rowbooleanfalseRow layout: label left + switch right
disabledbooleanfalseDisabled state
validation'valid' | 'invalid'Validation state
idstringNative id
namestringNative name