feat: initialize Vue component library and aligned documentation
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import { inject, useAttrs } from "vue";
|
||||
import { switchKey } from "../switch/context";
|
||||
const ctx = inject(switchKey, undefined);
|
||||
const attrs = useAttrs();
|
||||
defineProps<{
|
||||
isRequired?: boolean;
|
||||
isDisabled?: boolean;
|
||||
isInvalid?: boolean;
|
||||
}>();
|
||||
</script>
|
||||
<template>
|
||||
<component
|
||||
:is="ctx && !attrs.for ? 'span' : 'label'"
|
||||
class="hv-label"
|
||||
:class="{
|
||||
'hv-label--required': isRequired,
|
||||
'hv-label--disabled': isDisabled,
|
||||
'hv-label--invalid': isInvalid,
|
||||
}"
|
||||
data-slot="label"
|
||||
>
|
||||
<slot />
|
||||
</component>
|
||||
</template>
|
||||
Reference in New Issue
Block a user