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

PropTypeDefaultDescription
childrenReactNodeVisible label content. Compose LabelAsterisk, LabelOptional, or LabelSub inside it.
htmlForstringNative label association with the matching control id.
size"sm" | "md""md"Label text size. Use sm for dense settings rows.
disabledbooleanfalseSets aria-disabled and disabled styling on the label. It does not disable the control.
renderReactElement | (props, state) => ReactElementReplace the rendered element when composing into a custom form pattern.
...propsComponentProps<"label">Native label attributes.
PropTypeDefaultDescription
childrenReactNode"*"Marker content for required fields.
...propsComponentProps<"span">Native span attributes for rare custom markers or tests.
PropTypeDefaultDescription
childrenReactNode"(optional)"Marker content shown after the label.
...propsComponentProps<"span">Native span attributes for rare custom markers or tests.
PropTypeDefaultDescription
childrenReactNodeCustom secondary copy shown after the label.
...propsComponentProps<"span">Native span attributes for rare custom markers or tests.