# Label

A native label with Zenos typography and disabled-state styling.

A native label with Zenos typography and disabled-state styling.

```tsx
import { Grid, Input, Label, Stack } from "@zentara-co/zenos-ui";

function LabelExample() {
  return (
    <Grid columns={{ base: 1, md: 3 }} gap="5" className="w-full">
      <Stack gap="1">
        <Label
          htmlFor="project-name"
          tooltip="Shown on invoices and shared dashboards."
          tooltipLabel="Project name information"
        >
          Project name
        </Label>
        <Input id="project-name" placeholder="Security workspace" />
      </Stack>
      <Stack gap="1">
        <Label htmlFor="owner-email" required>
          Owner email
        </Label>
        <Input id="owner-email" type="email" required placeholder="owner@example.com" />
      </Stack>
      <Stack gap="1">
        <Label htmlFor="organization-id" disabled optional>
          Organization ID
        </Label>
        <Input id="organization-id" disabled defaultValue="org_01HZ9X" />
      </Stack>
    </Grid>
  );
}
```

## Import

```tsx
import { Label } from "@zentara-co/zenos-ui";
```

## Control association

Use `htmlFor` with a matching control `id`, or wrap a native labelable control. Clicking either label moves focus to or activates its associated control.

```tsx
import { Checkbox, Input, Label, Stack } from "@zentara-co/zenos-ui";

function LabelAssociationsExample() {
  return (
    <Stack gap="5" className="w-full max-w-md">
      <Stack gap="2">
        <Label htmlFor="standalone-email">Email address</Label>
        <Input id="standalone-email" type="email" autoComplete="email" />
      </Stack>
      <Label className="w-fit cursor-pointer">
        <Checkbox />
        Send weekly security report
      </Label>
    </Stack>
  );
}
```

## Label or Field.Label

Use standalone Label for a simple native association. Use `Field.Label` when the control also needs generated IDs, a description, an error, or inherited required, disabled, and invalid semantics.

```tsx
import { Field, Grid, Input, Label, Stack } from "@zentara-co/zenos-ui";

function LabelVsFieldExample() {
  return (
    <Grid columns={{ base: 1, md: 2 }} gap="5" className="w-full">
      <Stack gap="1">
        <Label htmlFor="quick-filter" tooltip="Filters the current asset list.">
          Quick filter
        </Label>
        <Input id="quick-filter" placeholder="Filter assets" />
      </Stack>
      <Field.Root required>
        <Field.Label tooltip="Receives incident notifications.">Notification email</Field.Label>
        <Field.Control render={<Input type="email" />} />
        <Field.Description>Receives incident notifications.</Field.Description>
      </Field.Root>
    </Grid>
  );
}
```

## Required, optional, and tooltip

Pass `required` to show the design-system asterisk, `optional` (or a custom string) for `(Optional)` copy, and `tooltip` with `tooltipLabel` for an info trigger that opens supporting text.

## Disabled and required presentation

Standalone `Label` uses the same header layout and affordances as `Field.Label`. Pass `required`, `optional`, and `tooltip` on the label itself, and set `disabled` (or `data-disabled`) when the paired control is disabled so the asterisk, optional copy, and info trigger match field styling.

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| htmlFor | string | — | ID of the labelled form control. |
| required | boolean | — | Shows a required asterisk after the label text. |
| optional | boolean \| string | — | Shows optional copy beside the label. true renders (Optional). |
| tooltip | ReactNode | — | Tooltip content for the info trigger beside the label. |
| tooltipLabel | string | — | Accessible name for the info trigger. |
| disabled | boolean | — | Mutes the label and affordances to match a disabled control. |
| data-disabled | boolean \| string | — | Alternative disabled presentation hook when not using the disabled prop. |
| native props | React.LabelHTMLAttributes<HTMLLabelElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

## Accessibility

Label renders a native `label`. Keep its text concise and specific, and do not replace it with placeholder text. Every `htmlFor` must match one labelable control’s `id`. Wrapped controls preserve the browser’s native click behavior.

Source: https://zenos-ui.pages.dev/components/label/