Label
Renders an accessible label associated with controls.
Features
- Text selection is prevented when double clicking label.
- Supports nested controls.
Installation
Install the component from your command line.
sh
$ npm add reka-uiAnatomy
Import the component.
vue
<script setup>
import { Label } from 'reka-ui'
</script>
<template>
<Label />
</template>API Reference
Root
Contains the content for the label.
| Prop | Default | Type |
|---|---|---|
as | 'label' | AsTag | ComponentThe element or component this component should render as. Can be overwrite by |
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | |
for | stringThe id of the element the label is associated with. |
Accessibility
This component is based on the native label element, it will automatically apply the correct labelling when wrapping controls or using the for attribute. For your own custom controls to work correctly, ensure they use native elements such as button or input as a base.
