Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Buttons

  • Button
  • ShimmerButton
  • InteractiveHoverButton
  • RainbowButton
  • PulsatingButton
  • RippleButton
  • ButtonGroup
  • SocialButton

Basic Inputs

  • Input
  • Textarea
  • CellEditor
  • Select
  • Checkbox
  • CheckboxGroup
  • Radio
  • Switch
  • Toggle
  • Segmented
  • Slider
  • NumberField
  • ElasticSlider

Advanced Inputs

  • MathTextarea
  • QuestionEditor
  • QuestionAnswer
  • MathField
  • SecretField
  • PasswordGenerator
  • Combobox
  • RemoteSelect
  • Listbox
  • Mentions
  • InputOTP
  • Rating
  • Upload
  • RegionSelect
  • ImageCropper
  • ScopeMatrix
  • Transfer
  • Cascader
  • TreeSelect
  • RegionCascader
  • CountrySelect
  • MarkdownEditor
  • Novel editor
  • RichTextEditor
  • CodeEditor
  • IssueReporter
  • ColorPicker
  • ColorField
  • ColorSwatchPicker
  • Choicebox
  • EmojiPicker
  • VoiceRecord
  • IconPicker
  • InspectorPanel

Date and Time

  • Calendar
  • DatePicker
  • DateTimePicker
  • DateRangePicker
  • TimePicker
  • TimeField

Form Frameworks

  • Form
  • ModalForm / DrawerForm
  • ProForm
  • StepsForm
  • LoginForm
  • AuthPanel
  • ClickCaptcha
  • Label
  • Field
  • SearchForm

ProForm

pro-form

Coordinates form state with submit-reset footers, async loading, and custom footer content.

Usage

Basic usage

Inline form: comes with submit/reset footer, submit it to onFinish.

tsx
<ProForm onFinish={(values) => api.save(values)}>
  <Field label="Name">
    <Input placeholder="Required" />
  </Field>
  <Field label="Email">
    <Input placeholder="including @" />
  </Field>
</ProForm>

Responsive Grid

columns=2 Adapt according to container width (container query, non-viewport breakpoint); use Field colSpan=full for a single field to span the entire row.

tsx
<ProForm columns={2} submitText="Save">
  <Field label="name"><Input /></Field>
  <Field label="Last name"><Input /></Field>
  <Field label="Detailed address" colSpan="full"><Input /></Field>
</ProForm>

Bottom right aligned

footerAlign=right makes the operating area stick to the right; use showReset={false} to hide the reset.

tsx
<ProForm footerAlign="right" showReset={false} submitText="Submit">
  <Field label="Remarks">
    <Input />
  </Field>
</ProForm>

When to use

Use ProForm for a persistent inline form that needs its own submit/reset footer and responsive field grid, such as an edit or settings page. It is the inline counterpart to ModalForm / DrawerForm: both integrate useForm and an automatic footer, but ProForm does not open an overlay. Use ModalForm or DrawerForm inside an overlay, Form for a bare container with a consumer-owned footer, or SearchForm for query filters.

Import

ts
import { ProForm } from "@hulianui/ui"

Props

NameTypeDefaultDescription
formFormInstance-useForm instance. When provided, submission calls validate() first and reset calls form.resetFields().
submitTextstringlocale.proForm.submitSubmit button label.
resetTextstringlocale.proForm.resetReset button label.
showResetbooleantrueShows the reset button; meaningful only when form is provided.
columns1 | 2 | 31Field-grid columns. Counts ≥2 respond to container width and collapse to one column when narrow. Use <Field colSpan="full"> for a full row.
footerAlign"left" | "right""left"Footer action alignment.
classNamestring-Container class name

Events

EventTypeDescription
onFinish(values: FormValues) => void | boolean | Promise<void | boolean>Submission callback. A Promise enables button loading; rejection is absorbed so the consumer can present feedback.

Slots

SlotTypeDescription
footerReactNodeCustomize the bottom action area (override the default submit/reset button)
childrenReactNodeform fields

Example

tsx
const form = useForm({ initialValues: { name: "", email: "" } });
const name = form.register("name", { rules: [{ required: true, message: "Please enter name" }] });
const email = form.register("email", { rules: [{ pattern: /@/, message: "Email must contain @" }] });

<ProForm form={form} onFinish={async (v) => { await api.save(v); }}>
  <Field label="Name" error={name.error}>
    <Input value={name.value as string} onChange={name.onChange} onBlur={name.onBlur} />
  </Field>
  <Field label="Email" error={email.error}>
    <Input value={email.value as string} onChange={email.onChange} onBlur={email.onBlur} />
  </Field>
</ProForm>
tsx
// Container-responsive grid; full-width fields span every column
<ProForm form={form} columns={2} submitText="Save" onFinish={() => {}}>
  <Field label="First name"><Input {...bind(reg.first)} /></Field>
  <Field label="Last name"><Input {...bind(reg.last)} /></Field>
  <Field label="Street address" colSpan="full"><Input {...bind(reg.addr)} /></Field>
</ProForm>

Usage guidelines

  • columns responds to the form container, not the viewport. Do not recreate the grid with media queries; use <Field colSpan="full"> for a field spanning all columns.
  • Unlike ModalForm, ProForm absorbs a rejected onFinish Promise. Present errors through consumer-owned feedback such as a toast.
  • Reset requires form because it calls form.resetFields(). Supplying footer replaces the default submit/reset controls, so custom footer actions must invoke the desired submission and reset logic.

Related

Form · ModalForm / DrawerForm · StepsForm · LoginForm · Field · SearchForm

PreviousModalForm / DrawerFormFormsNextInspectorPanel

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Slots
    • Example
    • Usage guidelines
    • Related