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).
| Type | Default | Required |
|---|---|---|
boolean | false | ❌ |
color
Color of the text when active.
| Type | Default | Required |
|---|---|---|
'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'danger' | 'light' | 'medium' | 'dark' | 'primary' | ❌ |
disabled
Disables interaction.
| Type | Default | Required |
|---|---|---|
boolean | false | ❌ |
labels
Custom text for the on/off states.
| Type | Default | Required |
|---|---|---|
{on: string, off: string} | { on: 'ON', off: 'OFF' } | ❌ |
The labels object has this shape:
| Field | Type | Required | Description |
|---|---|---|---|
on | string | ✅ | ON state text |
off | string | ✅ | OFF state text |
design
Design line (or inherit from data-design).
| Type | Default | Required |
|---|---|---|
'tuix' | 'rubik' | — (inherits from data-design) | ❌ |
Events
| Event | Payload | Description |
|---|---|---|
update:modelValue | boolean | Emitted on toggle |
CSS Custom Properties
| Token | Default | Description |
|---|---|---|
--font-mono | "JetBrains Mono", ui-monospace, monospace | Monospace font stack for code-like content (key labels, log lines, chips). |
--accent | from theme (--ctp-latte-mauve / --ctp-mocha-mauve) | Accent color, mapped from the active semantic color. |
--text-muted | from theme (--ctp-latte-subtext1 / --ctp-mocha-subtext1) | Secondary text for hints, annotations and disabled state. |
--color-primary | from theme (--ctp-latte-mauve / --ctp-mocha-mauve) | Primary semantic color (mauve in Catppuccin). |
--color-secondary | from theme (--ctp-latte-lavender / --ctp-mocha-lavender) | Secondary semantic color (lavender in Catppuccin). |
--color-tertiary | from theme (--ctp-latte-blue / --ctp-mocha-blue) | Tertiary semantic color (blue in Catppuccin). |
--color-success | from theme (--ctp-latte-green / --ctp-mocha-green) | Success semantic color (green in Catppuccin). |
--color-warning | from theme (--ctp-latte-yellow / --ctp-mocha-yellow) | Warning semantic color (yellow in Catppuccin). |
--color-danger | from theme (--ctp-latte-red / --ctp-mocha-red) | Danger semantic color (red in Catppuccin). |
--color-light | from theme (--ctp-latte-surface1 / --ctp-mocha-rosewater) | Light semantic color (lighter contrast tone). |
--color-medium | from theme (--ctp-latte-overlay0 / --ctp-mocha-overlay2) | Medium semantic color (mid-tone). |
--color-dark | from theme (--ctp-latte-text / --ctp-mocha-subtext1) | Dark semantic color (high contrast text). |
--cp-ease | cubic-bezier(.4, 0, .2, 1) | Default easing curve for transitions. |
Ver Theming para la convención completa.