قسم النموذج (FormSection)

تجمع كتلة قسم النموذج (FormSection) الحقول المترابطة، مع تسمياتها وأوصافها.

التثبيت

bash
npx @smicolon/fasla-ui@latest add form-section

قبل إضافة أي مكوّن، شغّل الأمر init مرة واحدة في مشروعك. التفاصيل في صفحة التثبيت.

معاينة

المعلومات الشخصية

حدّث بياناتك الشخصية.

مع رسالة خطأ

أزرار النموذج

الخصائص (props)

يضم الجدول خصائص (props) الأجزاء FormSection، FormField، FormActions.

الخاصيةالنوعالافتراضيالوصف
titlestringلا يوجدعنوان القسم.
descriptionstringلا يوجدنص تحت العنوان أو التسمية.
dividerbooleantrueيُظهر فاصلًا في الأسفل.
labelstringلا يوجدتسمية الحقل.
errorstringلا يوجدرسالة خطأ تحت الحقل.
requiredbooleanfalseيعلّم الحقل بأنه مطلوب.
htmlForstringلا يوجديربط التسمية بحقلها.
align"left" | "right" | "center" | "between""right"محاذاة أزرار الإجراءات.
stickybooleanfalseيثبّت الأزرار في أسفل الصفحة.
classNamestringلا يوجدأصناف (class) إضافية للجزء.

الاستخدام

tsx
import { FormSection, FormField, FormActions } from "@/components/blocks/form-section"
import { Input } from "@/components/ui/input"
import { Button } from "@/components/ui/button"

export function AccountForm() {
  return (
    <form>
      <FormSection title="الحساب" description="حدّث إعدادات حسابك.">
        <FormField label="البريد الإلكتروني" htmlFor="email" required>
          <Input id="email" name="email" type="email" required />
        </FormField>
      </FormSection>

      <FormActions>
        <Button type="reset" variant="outline">إلغاء</Button>
        <Button type="submit">حفظ</Button>
      </FormActions>
    </form>
  )
}