Description
Provides supplementary text for form fields and other components
Import
import { Description } from '@heroui/react';
Usage
API
Description Props
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | - | Additional CSS classes |
children | ReactNode | - | The content of the description |
Accessibility
The Description component enhances accessibility by:
- Using semantic HTML that screen readers can identify
- Providing the
slot="description"attribute for React Aria integration - Supporting proper text contrast ratios
Styling
The Description component uses the following CSS classes:
.description- Base description styles withmutedtext color
Examples
With Form Fields
<div className="flex flex-col gap-1">
<Label htmlFor="password">Password</Label>
<Input id="password" type="password" aria-describedby="password-description" />
<Description id="password-description">
Must be at least 8 characters with one uppercase letter
</Description>
</div>
Integration with TextField
import {TextField, Label, Input, Description} from '@heroui/react';
<TextField type="email">
<Label>Email</Label>
<Input placeholder="Enter your email" />
<Description>We'll never share your email</Description>
</TextField>
When using the TextField component, accessibility attributes are automatically applied to the label and description.
Local source: vendor/en/react/components/(forms)/description.mdx
Generated from the pinned HeroUI v3 commit with internal links and previews adapted for JGuang.
DateRangePickerDateRangePicker 日期范围选择器
Composable date range picker built on React Aria DateRangePicker with DateField and RangeCalendar composition基于 React Aria DateRangePicker 的可组合日期范围选择器,由 DateField 与 RangeCalendar 组合而成。
DisclosureDisclosure 折叠面板
A disclosure is a collapsible section with a header containing a heading and a trigger button, and a panel that wraps the content.Disclosure 是一种可折叠区域:头部包含标题与触发按钮,面板包裹正文内容。