UIPackage

Label

Vue form
Edit on GitHub

Accessible label primitive — wraps text and binds to its child input via `for`. Disabled-state styling, optional required-asterisk, and proper screen-reader behavior.

Also available for React ->

Installation

$ npx shadcn-vue@latest add https://uipkge.dev/r/vue/label.json

Or with the named registry: npx shadcn-vue@latest add @uipkge/label

Examples

Props

Name Type / Values Default Required
class HTMLAttributes['class'] optional

Dependencies

Used by

Files (2)

  • app/components/ui/label/Label.vue 0.8 kB
    <script setup lang="ts">
    import type { LabelProps } from 'reka-ui'
    import type { HTMLAttributes } from 'vue'
    import { reactiveOmit } from '@vueuse/core'
    import { Label } from 'reka-ui'
    import { cn } from '@/lib/utils'
    
    const props = defineProps<LabelProps & { class?: HTMLAttributes['class'] }>()
    
    const delegatedProps = reactiveOmit(props, 'class')
    </script>
    
    <template>
      <Label
        data-uipkge
        data-slot="label"
        v-bind="delegatedProps"
        :class="
          cn(
            'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
            props.class,
          )
        "
      >
        <slot />
      </Label>
    </template>
  • app/components/ui/label/index.ts 0 kB
    export { default as Label } from './Label.vue'

Raw manifest: https://uipkge.dev/r/vue/label.json