Label

A form label primitive with required and secondary text markers.

Preview#

import { Label, LabelAsterisk } from "raft-ui";

<Label>
  <LabelAsterisk />
</Label>

Markers#

Prefer explicit composition over boolean label props. Use LabelAsterisk for required fields, LabelOptional for optional markers, and LabelSub for custom secondary copy.

States#

Disabled label styling is only visual and semantic. Disable the actual form control separately.

API#WIP

children
ReactNode
Visible label content. Compose LabelAsterisk, LabelOptional, or LabelSub inside it.
htmlFor
string
Native label association with the matching control id.
sizedefault: "md"
"sm" | "md"
Label text size. Use sm for dense settings rows.
disableddefault: false
boolean
Sets aria-disabled and disabled styling on the label. It does not disable the control.
render
ReactElement | (props, state) => ReactElement
Replace the rendered element when composing into a custom form pattern.
...props
ComponentProps<"label">
Native label attributes.
childrendefault: "*"
ReactNode
Marker content for required fields.
...props
ComponentProps<"span">
Native span attributes for rare custom markers or tests.
childrendefault: "(optional)"
ReactNode
Marker content shown after the label.
...props
ComponentProps<"span">
Native span attributes for rare custom markers or tests.
children
ReactNode
Custom secondary copy shown after the label.
...props
ComponentProps<"span">
Native span attributes for rare custom markers or tests.