Skip to content
v0.2.10

Label

A native label that connects a visible name to a control.

Preview

Use Label

Label is a named export of @flood-md/react. Connect the package once, then import what you use.

First time here? Connect Flood
Example import style
label.tsxTSX
"use client";

import { FloodRoot, Label, Stack, Input } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <Stack gap="2">
        <Label htmlFor="project-label">Project name</Label>
        <Input id="project-label" defaultValue="My project" />
      </Stack>
    </FloodRoot>
  );
}

Design notes

  • htmlFor connects the label to a matching control ID; implicit nested controls also retain native behavior.
  • required adds a decorative marker only. Set required on the actual control as well. Field already composes Label.

API reference

PropValuesDefault
requiredboolean—
Native HTML propsLabelHTMLAttributes<HTMLLabelElement>Forwarded
View TypeScript source