Skip to content

Toggle ​

Terminal-style toggle switch with [ON] / [OFF].

Toggle

Design lines ​

[ON]
vue
1<Tabs defaultValue="tuix">2  <TabsList>3    <Tab value="tuix">TUIX</Tab>4    <Tab value="rubik">Rubik</Tab>5  </TabsList>6  <TabPanel value="tuix">7    <Toggle :model-value="true" design="tuix" />8  </TabPanel>9  <TabPanel value="rubik">10    <Toggle :model-value="true" design="rubik" />11  </TabPanel>12</Tabs>

Demo ​

Basic (modelValue) ​

Binds the toggle state with v-model through modelValue.

vue
1<Toggle v-model="enabled" />2<Toggle v-model="custom" :labels="{ on: 'YES', off: 'NO' }" color="success" />

Color (color) ​

Each toggle is active with its own state so the active color is visible.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Toggle } from '@dowardev/herdrate-vue'45const colorOnPrimary = ref(true)6const colorOnSuccess = ref(true)7const colorOnWarning = ref(true)8const colorOnDanger = ref(true)9</script>1011<template>12  <Toggle v-model="colorOnPrimary" color="primary" />13  <Toggle v-model="colorOnSuccess" color="success" />14  <Toggle v-model="colorOnWarning" color="warning" />15  <Toggle v-model="colorOnDanger" color="danger" />16</template>

Props ​

modelValue ​

State of the toggle (boolean v-model).

TypeDefaultRequired
booleanfalse❌

color ​

Color of the text when active.

TypeDefaultRequired
'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'danger' | 'light' | 'medium' | 'dark''primary'❌

disabled ​

Disables interaction.

TypeDefaultRequired
booleanfalse❌

labels ​

Custom text for the on/off states.

TypeDefaultRequired
{on: string, off: string}{ on: 'ON', off: 'OFF' }❌

The labels object has this shape:

FieldTypeRequiredDescription
onstring✅ON state text
offstring✅OFF state text

design ​

Design line (or inherit from data-design).

TypeDefaultRequired
'tuix' | 'rubik'— (inherits from data-design)❌

Events ​

EventPayloadDescription
update:modelValuebooleanEmitted on toggle

CSS Custom Properties ​

TokenDefaultDescription
--font-mono"JetBrains Mono", ui-monospace, monospaceMonospace font stack for code-like content (key labels, log lines, chips).
--accentfrom theme (--ctp-latte-mauve / --ctp-mocha-mauve)Accent color, mapped from the active semantic color.
--text-mutedfrom theme (--ctp-latte-subtext1 / --ctp-mocha-subtext1)Secondary text for hints, annotations and disabled state.
--color-primaryfrom theme (--ctp-latte-mauve / --ctp-mocha-mauve)Primary semantic color (mauve in Catppuccin).
--color-secondaryfrom theme (--ctp-latte-lavender / --ctp-mocha-lavender)Secondary semantic color (lavender in Catppuccin).
--color-tertiaryfrom theme (--ctp-latte-blue / --ctp-mocha-blue)Tertiary semantic color (blue in Catppuccin).
--color-successfrom theme (--ctp-latte-green / --ctp-mocha-green)Success semantic color (green in Catppuccin).
--color-warningfrom theme (--ctp-latte-yellow / --ctp-mocha-yellow)Warning semantic color (yellow in Catppuccin).
--color-dangerfrom theme (--ctp-latte-red / --ctp-mocha-red)Danger semantic color (red in Catppuccin).
--color-lightfrom theme (--ctp-latte-surface1 / --ctp-mocha-rosewater)Light semantic color (lighter contrast tone).
--color-mediumfrom theme (--ctp-latte-overlay0 / --ctp-mocha-overlay2)Medium semantic color (mid-tone).
--color-darkfrom theme (--ctp-latte-text / --ctp-mocha-subtext1)Dark semantic color (high contrast text).
--cp-easecubic-bezier(.4, 0, .2, 1)Default easing curve for transitions.

Ver Theming para la convención completa.