
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@easylibs/progress-form
Advanced tools
The `ProgressForm` class provides an elegant solution for creating multi-step forms with a progress bar. It allows users to navigate through different sections of a form efficiently by breaking it down into manageable fieldsets. Each step of the form is d
The ProgressForm class provides an elegant solution for creating multi-step forms with a progress bar. It allows users to navigate through different sections of a form efficiently by breaking it down into manageable fieldsets. Each step of the form is displayed one at a time, and users can move forward or backward through the steps using the provided navigation buttons. The progress bar dynamically reflects the user's current position within the form.
To install the ProgressForm library, use one of the following methods:
Via npm:
npm install @easylibs/progress-form
Via Yarn:
yarn add @easylibs/progress-form
Via pnpm:
pnpm add @easylibs/progress-form
Alternatively, you can include the library directly from a CDN:
Minified:
<script src="https://cdn.jsdelivr.net/npm/@easylibs/progress-form@latest/dist/progress-form.min.js"></script>
<script src="https://unpkg.com/@easylibs/progress-form@latest/dist/progress-form.min.js"></script>
Unminified:
<script src="https://cdn.jsdelivr.net/npm/@easylibs/progress-form@latest/dist/progress-form.js"></script>
<script src="https://unpkg.com/@easylibs/progress-form@latest/dist/progress-form.js"></script>
ProgressFormTo create a multi-step form using ProgressForm, you need to structure your HTML with fieldsets. Each fieldset represents a step in the form.
HTML Example:
<form id="progress-form" method="post">
<div fieldset__parent>
<div fieldset__container>
<!-- First Fieldset -->
<fieldset>
<label for="name">Name:</label>
<input type="text" id="name">
<button type="button" __next__>Next</button>
</fieldset>
<!-- Second Fieldset -->
<fieldset>
<label for="surname">Surname:</label>
<input type="text" id="surname">
<button type="button" __prev__>Previous</button>
<button type="button" __next__>Next</button>
</fieldset>
<!-- Third Fieldset -->
<fieldset>
<label for="sex">Sex:</label>
<select id="sex">
<option value="male">Male</option>
<option value="female">Female</option>
</select>
<button type="button" __prev__>Previous</button>
<button type="button" __next__>Next</button>
</fieldset>
<!-- Fourth Fieldset -->
<fieldset>
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<button type="button" __prev__>Previous</button>
<button type="button" __next__>Next</button>
</fieldset>
<!-- Fifth Fieldset -->
<fieldset>
<label for="password">Password:</label>
<input type="password" id="password" name="password">
<button type="button" __prev__>Previous</button>
<button type="button" id="submitter">Submit</button>
</fieldset>
</div>
</div>
</form>
JavaScript Example:
import { ProgressForm } from "@easylibs/progress-form";
// Select the form element
const form = document.getElementById('progress-form');
// Create a new ProgressForm instance
const progressForm = new ProgressForm(form);
// Initialize the form
progressForm.run();
Customizing Fieldset Movement:
You can adjust the form's appearance and fieldset transitions using the translateX option:
const translateX = -560; // Adjust this value based on your design
progressForm.run({ translateX });
LazyProgressFormWhen dealing with large forms or dynamic content, LazyProgressForm allows for efficient lazy loading of fieldsets. This means that fieldsets are only loaded as needed, rather than all at once.
HTML Structre:
Just define the first fieldset
<form id="progress-form" method="post">
<div fieldset__parent>
<div fieldset__container>
<!-- First Fieldset -->
<fieldset>
<label for="name">Name:</label>
<input type="text" id="name">
<button type="button" __next__>Next</button>
</fieldset>
</div>
</div>
</form>
JavaScript Example:
import { LazyProgressForm } from "@easylibs/progress-form";
// Select the form element
const lazyFormElement = document.querySelector('form');
//the link to your server to retrieve the other fieldsets.
//note that you will need to add to each fieldset a class "fieldset{i}" with "i"
//corresponding to the index of the fieldset.
//LazyProgressForm will automatically inject the class "fieldset0" to the first fieldset by default.
const url = "https://example.com/fieldset-getter"
// Create a new LazyProgressForm instance
const lazyProgressForm = new LazyProgressForm(lazyFormElement, url);
// Initialize the lazy form with configuration options
lazyProgressForm.lazyRun({
fieldsetLength: 3,
progressOptions: {
translateX: -700
},
styleOptions: {
form: { width: "700px" },
fieldset: { width: "640px" },
fieldsetContainer: {
justifyContent: "null"
}
}
})
lazyProgressForm.fetchNextFieldSet({
spinner: "Loading...",
shouldRepost: true,
callbacks:{
onSuccess(response, index, ...data) {
console.log({ index, response, data}) // run if request status is 200
},
onPreFetch(data, index) {
console.log({data, index}) // run before fetch call
},
onError(error, status, index) {
console.log({error, status, index}) // run if request status is not a 200 group status exemple:(500, 400 or 300)
}
}
})
constructor(form: HTMLFormElement, enableDefaultCssStyle: boolean = true)
ProgressForm instance.form: The HTML form element to be managed.enableDefaultCssStyle: Whether to apply default CSS styles (default: true).run(progressOptions?: ProgressFormType, styleOptions?: StyleOptions, preventProgress?: PreventType)
progressOptions: Configuration for form progression (e.g., transition effects).styleOptions: Custom styles for the form.preventProgress: Conditions under which progression should be prevented.next(nextIndex: number, nextTranslateX: number, nextButton?: HTMLElement, progressElement?: HTMLElement, nextProgress?: number)
nextIndex: Index of the next fieldset.nextTranslateX: X translation value for the transition.nextButton: The button element that triggered the action.progressElement: Element displaying progress.nextProgress: Progress value.prev(prevIndex: number, prevTranslateX: number, prevButton?: HTMLElement, progressElement?: HTMLElement, prevProgress?: number)
prevIndex: Index of the previous fieldset.prevTranslateX: X translation value for the transition.prevButton: The button element that triggered the action.progressElement: Element displaying progress.prevProgress: Progress value.constructor(form: HTMLFormElement, url: string, parentTarget?: string)
LazyProgressForm instance.form: The HTML form element to be managed.url: URL to fetch fieldsets from.parentTarget: Optional CSS class for the parent container.lazyRun(fieldsetLength: number, progressOptions?: ProgressFormType, styleOptions?: StyleOptions)
fieldsetLength: Number of fieldsets.progressOptions: Configuration for form progression.styleOptions: Custom styles for the form.fetchNextFieldSet(data: FieldSetGetterData)
data.template: The template for the fieldset.data.spinner: Spinner or loading indicator.data.shouldRepost: Whether to post a fieldset's data when its "next" button is clicked again.data.extraData: Additional data to add to the form at each stepdata.callbacksCustomize the appearance of your form using the following options:
Configure form progression with these options:
Define conditions under which form progression should be prevented.
The ProgressForm library offers a powerful and flexible solution for creating dynamic, multi-step forms with a user-friendly progress bar. Whether you need a simple form or a more complex form with lazy loading capabilities, this library provides the tools and customization options to meet your needs.
This project is licensed under the MIT License - see the LICENSE file for details.
For more detailed information and examples, please refer to the official documentation and resources provided.
FAQs
The `ProgressForm` class provides an elegant solution for creating multi-step forms with a progress bar. It allows users to navigate through different sections of a form efficiently by breaking it down into manageable fieldsets. Each step of the form is d
We found that @easylibs/progress-form demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.