🌐 Nodejs.cn

渲染与控件关联的可访问标签。

import { Checkbox } from "@/components/ui/checkbox"
import { Label } from "@/components/ui/label"

安装

🌐 Installation

pnpm dlx shadcn@latest add label

用法

🌐 Usage

import { Label } from "@/components/ui/label"
<Label htmlFor="email">Your email address</Label>

字段中的标签

🌐 Label in Field

对于表单字段,请使用包含内置 FieldLabelFieldDescriptionFieldError 组件的 Field 组件。

🌐 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>
Payment Method

All transactions are secure and encrypted

Enter your 16-digit card number

Billing Address

The billing address associated with your payment method

import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import {

从右到左

🌐 RTL

要在 shadcn/ui 中启用 RTL 支持,请参阅 RTL 配置指南

🌐 To enable RTL support in shadcn/ui, see the RTL configuration guide.

"use client"

import * as React from "react"

API参考

🌐 API Reference

有关更多信息,请参阅 Radix UI Label 文档。

🌐 See the Radix UI Label documentation for more information.