فیلد (Field)
wrapper پیشرفته برای فیلدهای فرم
معرفی
کامپوننت Field یک wrapper کامل برای مدیریت فیلدهای فرم است که شامل label، description، error و layout میشود.
استفاده
نام کاربری شما برای ورود استفاده میشود
این فیلد الزامی است
import {
Field,
FieldLabel,
FieldDescription,
FieldError,
Input,
} from '@parto/ui';
export default function MyComponent() {
return (
<Field>
<FieldLabel>نام کاربری</FieldLabel>
<Input placeholder="نام کاربری خود را وارد کنید" />
<FieldDescription>
نام کاربری شما باید یکتا باشد
</FieldDescription>
</Field>
);
}با خطا
<Field data-invalid="true">
<FieldLabel>ایمیل</FieldLabel>
<Input type="email" aria-invalid="true" />
<FieldError>ایمیل معتبر نیست</FieldError>
</Field>چینش افقی
<Field orientation="horizontal">
<FieldLabel>تنظیمات</FieldLabel>
<FieldContent>
<Switch />
<FieldDescription>فعالسازی اعلانها</FieldDescription>
</FieldContent>
</Field>FieldSet برای گروهبندی
<FieldSet>
<FieldLegend>اطلاعات شخصی</FieldLegend>
<FieldGroup>
<Field>
<FieldLabel>نام</FieldLabel>
<Input />
</Field>
<Field>
<FieldLabel>نام خانوادگی</FieldLabel>
<Input />
</Field>
</FieldGroup>
</FieldSet>با جداکننده
<FieldGroup>
<Field>
<FieldLabel>فیلد اول</FieldLabel>
<Input />
</Field>
<FieldSeparator>یا</FieldSeparator>
<Field>
<FieldLabel>فیلد دوم</FieldLabel>
<Input />
</Field>
</FieldGroup>Props
Field
| Prop | Type | Default | توضیحات |
|---|---|---|---|
orientation | 'vertical' | 'horizontal' | 'responsive' | 'vertical' | جهت چینش |
data-invalid | boolean | - | نمایش حالت خطا |
کامپوننتها
Field- wrapper اصلیFieldLabel- برچسب فیلدFieldDescription- توضیحاتFieldError- پیام خطاFieldGroup- گروهبندی فیلدهاFieldSet- fieldset برای فرمFieldLegend- عنوان fieldsetFieldSeparator- جداکنندهFieldContent- محتوای فیلدFieldTitle- عنوان بدون label