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

StepsForm

steps-form

Splits a validated workflow across ordered steps with controlled navigation.

Usage

Basic usage

Steps indicator + Previous/Next/Submit navigation; only the current step content is mounted, the value is retained by the consumer useForm step.

  1. 1Basic informationName
  2. 2Company InformationCompany
  3. 3Contact informationEmail
tsx
<StepsForm
  onFinish={async () => { await api.save(); }}
  steps={[
    { title: "Basic information", content: <Field label="Name"><Input /></Field> },
    { title: "Company Information", content: <Field label="Company"><Input /></Field> },
    { title: "Contact Information", content: <Field label="Email"><Input /></Field> },
  ]}
/>

Step by step verification

onStepValidate Verify this step field before moving forward; return false / reject to prevent moving forward, pending during button loading.

  1. 1Upload
  2. 2Confirm
tsx
<StepsForm
  onStepValidate={async (step) =>
    (await form.validateField(fieldsOf(step))) == null
  }
  steps={steps}
/>

Vertical steps

direction=vertical Makes step indicators line up vertically to fit into narrow sidebars.

  1. 1First step
  2. 2Step 2
tsx
<StepsForm direction="vertical" steps={steps} />

When to use

Use StepsForm for guided flows such as registration, account setup, or data import when a long form should be divided and validated step by step. Form and ProForm show all fields and submit once; StepsForm renders only the current step. Field values remain in the consumer's useForm instance because StepsForm does not own form state.

Import

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

Props

NameTypeDefaultDescription
steps*StepsFormStep[]-Step definitions containing title, description, content, nextDisabled, nextText, and showNav.
currentnumber-Zero-based current step in controlled mode.
defaultCurrentnumber0Initial step when uncontrolled.
direction"horizontal" | "vertical""horizontal"Steps indicator direction.
classNamestring-Additional class name for the root element.

Events

EventTypeDescription
onCurrentChange(current: number) => voidCalled with the new zero-based index when the step changes.
onStepValidate(currentStep: number) => boolean | Promise<boolean>Runs before leaving a step. Return false or reject to block navigation; async work keeps the forward button loading.
onFinish() => void | Promise<void>Called when submitting the final step; a Promise enables submit-button loading.

StepsFormStep fields: title: ReactNode (required), description?, content: ReactNode (required and rendered only for the current step), nextDisabled? (defaults to false and prevents advancing from this step), nextText? (overrides the localized forward-button label), and showNav? (defaults to true; set it to false to hide this step's footer navigation, typically for a result step with its own actions).

Example

tsx
const form = useForm({ initialValues: { name: "", company: "" } });
const name = form.register("name", { rules: [{ required: true, message: "Please enter name" }] });

<StepsForm
  onStepValidate={async (step) => {
    if (step === 0) return (await form.validateField("name")) == null;
    return true;
  }}
  onFinish={async () => {
    const r = await form.validate();
    if (r.ok) await api.save(r.values);
  }}
  steps={[
    { title: "Basic information", content: (
        <Field label="Name" error={name.error}>
          <Input value={name.value as string} onChange={name.onChange} onBlur={name.onBlur} />
        </Field>
      ) },
    { title: "Company information", content: <Field label="Company">{/* ... */}</Field> },
  ]}
/>

Usage guidelines

  • StepsForm does not own field values. Keep them in the consumer's useForm or unmounted step content will lose local input state. In onStepValidate, validate only the current step with form.validateField; a full form.validate() would reject empty future fields.
  • Pair controlled current with onCurrentChange, or navigation cannot advance.
  • For a result step with its own actions such as “Start again,” set showNav: false to hide built-in navigation.

Related

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

PreviousInspectorPanelFormsNextLoginForm

On this page

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