Skip to content

Label Primitive

A user-friendly label linked to controls for improved accessibility.

Installation

Install the component via your command line.

Terminal window
npx expo install @rn-primitives/label

Usage

import * as LabelPrimitive from '@rn-primitives/label';
function Example() {
const [checked, setChecked] = React.useState(false);
return (
<Label.Root>
<Label.Text
nativeID='to-be-use-by-aria-labelledby-from-form-field'
>
Label
</Label.Text>
</Label.Root>
);
}

Props

Root

Extends Pressable props except children | hitSlop | style

PropTypeNote
children*React.ReactNode
styleViewStyle(optional)

Text

Extends Text props

PropTypeNote
nativeID*stringthe same value needs be use by aria-labelledby from form field
htmlForstringweb only