Skip to content

Toggle ​

A two-state button that can be either on or off.

Examples ​

Default ​

vue
<script setup>
import { Toggle } from '@empathyds/vue'
import { Bold } from 'lucide-vue-next'
</script>

<Toggle aria-label="Toggle bold">
  <Bold class="h-4 w-4" />
</Toggle>

Outline ​

vue
<script setup>
import { Toggle } from '@empathyds/vue'
import { Bold } from 'lucide-vue-next'
</script>

<Toggle variant="outline" aria-label="Toggle bold">
  <Bold class="h-4 w-4" />
</Toggle>

With Text ​

vue
<script setup>
import { Toggle } from '@empathyds/vue'
import { Bold } from 'lucide-vue-next'
</script>

<Toggle aria-label="Toggle italic">
  <Bold class="mr-2 h-4 w-4" />
  Bold
</Toggle>

Props ​

Toggle ​

PropTypeDefaultDescription
pressedboolean-The controlled pressed state of the toggle.
defaultPressedbooleanfalseThe default pressed state of the toggle.
disabledbooleanfalseWhether the toggle is disabled.

Slots ​

Toggle ​

SlotDescription
defaultThe content of the toggle.