apps/v4/content/docs/components/base/label.mdx
npx shadcn@latest add label
<Step>Install the following dependencies:</Step>
npm install @base-ui/react
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource name="label" title="components/ui/label.tsx" styleName="base-nova" />
<Step>Update the import paths to match your project setup.</Step>
</Steps> </TabsContent> </CodeTabs>import { Label } from "@/components/ui/label"
<Label htmlFor="email">Your email address</Label>
For form fields, use the Field component which
includes built-in FieldLabel, FieldDescription, and FieldError components.
<Field>
<FieldLabel htmlFor="email">Your email address</FieldLabel>
<Input id="email" />
</Field>
<ComponentPreview styleName="base-nova" name="field-demo" previewClassName="h-[44rem]" />
To enable RTL support in shadcn/ui, see the RTL configuration guide.
<ComponentPreview styleName="base-nova" name="label-rtl" direction="rtl" />See the Base UI Label documentation for more information.