Label Primitive
A user-friendly label linked to controls for improved accessibility.
Installation
Install the component via your command line.
Install @radix-ui/react-label
Copy/paste the following code for web to ~/components/primitives/label/label.web.tsx
Copy/paste the following code for native to ~/components/primitives/label/label.tsx
Copy/paste the following code for types to ~/components/primitives/label/types.ts
Copy/paste the following code for exporting to ~/components/primitives/label/index.ts
Copy/paste the following code for native to ~/components/primitives/label/index.tsx
Copy/paste the following code for types to ~/components/primitives/label/types.ts
Usage
Props
Root
Extends Pressable
props except children
| hitSlop
| style
Prop | Type | Note |
---|---|---|
children* | React.ReactNode | |
style | ViewStyle | (optional) |
Text
Extends Text
props
Prop | Type | Note |
---|---|---|
nativeID* | string | the same value needs be use by aria-labelledby from form field |
htmlFor | string | web only |