17 lines
478 B
Vue
17 lines
478 B
Vue
<script setup lang="ts">
|
|
import { inject } from "vue";
|
|
import { switchKey } from "./context";
|
|
const ctx = inject(switchKey);
|
|
if (!ctx) throw new Error("SwitchControl must be inside Switch");
|
|
</script>
|
|
<template>
|
|
<span class="hv-switch__control" data-slot="switch-control">
|
|
<slot
|
|
:is-selected="ctx.checked.value"
|
|
:is-hovered="ctx.hovered.value"
|
|
:is-pressed="ctx.pressed.value"
|
|
:is-focus-visible="ctx.focusVisible.value"
|
|
/>
|
|
</span>
|
|
</template>
|