Label

The visible name of a field, with required and disabled states.

  • Composed
  • New in 0.1
import { Label, labelPrimitive } from "nitro-ui-sdk/label";
HeroUI Native
Label
Expo UI
Label
  • Label example screen, light appearance
    Light
  • Label example screen, dark appearance
    Dark
On this page

Label gives a form control a visible name and optional required indicator. Use Label.Scope to share a localized name and helper text with a native editor.

Anatomy

import { Label } from "nitro-ui-sdk/label";

<Label.Root required text="Email address">
  <Label.Text />
  <Label.Indicator />
</Label.Root>;
Part Description
Root Owns the spoken name and appearance.
Text Visible name.
Indicator Decorative required marker.
Scope Passes the name and optional description to an editor and its visible text.

Usage

import { Label } from "nitro-ui-sdk/label";
import { Input } from "nitro-ui-sdk/input";
<Label.Scope label="Email address">
  {(field) => <><Label.Root required /><Input.Root {...field} /></>}
</Label.Scope>;

Variants and sizes

The label uses one subheadline size. Customize with the text and indicator style parts.

States

Use required for a visible marker, invalid for danger text, and disabled for reduced opacity.

Props

Label.Root

Prop Type Default Description
text string Scoped label Localized name. String children can also supply the name.
required boolean false Show the required marker.
disabled boolean false Dim the visible label.
invalid boolean false Use the danger token.
children ReactNode — Content to render inside this part.
styles PartStyles<LabelPart, LabelVariant, LabelSize, LabelState> — Style resolvers keyed by part.
agentId string — Identity in a reused view.

Label.Text

Prop Type Default Description
part LabelPart — Override the style key for this part.
children string Root text Visible text and spoken name.

Label.Indicator

Prop Type Default Description
part LabelPart — Override the style key for this part.
children string "*" Visible required marker.

Label.Scope

Prop Type Default Description
label string Required Localized name shared with the editor.
description string — Shared helper text, passed as the editor hint.
children (field: { label: string; hint?: string }) => ReactNode Required Render the visible text and spread the supplied props on the editor.

Controller API

Read-only. The component has no attached controller actions.

Styles

import { Label } from "nitro-ui-sdk/label";

<Label.Root text="Email address" required styles={{ text: ({ tokens }) => ({ text: { color: tokens.colors.accent } }) }} />;

Resolvers receive tokens, variant, size, and state. State includes required, disabled, and invalid.

Accessibility

A standalone label is static text. Within Label.Scope the editor speaks its name and assistive technology skips the duplicate visible label. The required marker is decorative.

Agent API

Read-only.

Platform notes

iOS Android
Implementation Renderer views with UIKit accessibility semantics. Renderer views with TalkBack semantics.
Verification Native iOS harness in the example app. Kotlin is written for Android. The Android NDK is unavailable on this machine, so no Android build was run.