Skip to content

[Feature] Implement steps mechanism for modal component. #276

Description

@younisdev

Summary

Modal currently only renders all elements in a single static view. Add multi-step modal support, splitting a modal into sequential pages with next/back navigation and animated transitions between steps.

Proposed API

<Modal
  title="Register"
  theme="Crimson"
  steps={[
    {
      title: 'Account Details',
      elements: [
        { type: 'text', name: 'firstName', placeholder: 'First Name', amount: 1 }
      ]
    },
    {
      title: 'Security',
      elements: [
        { type: 'password', name: 'password', placeholder: 'Password', amount: 1 }
      ]
    }
  ]}
  onSubmit={(data) => console.log(data)}
/>

Requirements

  • Render only the current step's elements, reusing existing field rendering logic.
  • Next/Back buttons replace the default submit button, with Next becoming submit on the final step.
  • GSAP-animated transitions between steps, consistent with existing modal animations.
  • data and errors persist across steps.
  • Existing elements based modals must continue to work unchanged.

Additional Information

  • Check SerializeData and the field rendering block in modal.jsx before starting.
  • Validation should run per-step via handleValidation before allowing the Next page.
  • To test: npm install && npm run dev, add a multi-step example to devbench modal.jsx.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions