packages/react-components/react-label/library/README.md
Label components for Fluent UI React
Labels provide a name or title to a component or group of components, e.g., text fields, checkboxes, radio buttons, and dropdown menus.
To import Label:
import { Label } from '@fluentui/react-components';
import * as React from 'react';
import { Label } from '@fluentui/react-components';
import { useId } from '@fluentui/react-utilities';
export const labelExample = () => {
const inputId = useId('firstNameLabel-');
return (
<>
<Label htmlfor={inputId} required strong>
First Name
</Label>
<input id={inputId} />
</>
);
};
See Fluent UI Storybook for more detailed usage examples.
Alternatively, run Storybook locally with:
yarn startreact-label from the list.See Spec.md.
If you're upgrading to Fluent UI v9 see MIGRATION.md for guidance on updating to the latest Label implementation.