npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

preview-form

v2.0.1

Published

An accessible, privacy-aware review step for native HTML forms.

Readme

PreviewForm 2.0

PreviewForm is a dependency-free, accessible review step for native HTML forms. It creates a “check before send” experience without replacing your form’s validation or submission behavior.

Install

npm install preview-form
import { attachReview } from "preview-form";
import "preview-form/styles.css";

const review = attachReview(document.querySelector("#my-form"), {
  title: "Review your answers",
  confirmLabel: "Send application",
  sensitiveFields: "mask",
  files: "metadata"
});

For a CDN build, load dist/styles.css and dist/index.iife.js, then use PreviewForm.attachReview(form). For the jQuery CDN adapter, load jQuery first and then dist/jquery.iife.js; the adapter uses the existing window.jQuery and does not bundle another copy.

Supported behavior

PreviewForm discovers labels, legends, ARIA labels, text inputs, textareas, selects, radio groups, checkbox groups, and file metadata. Values are rendered as text. Passwords and sensitive-looking fields are masked by default, while empty optional fields are shown as Not provided.

PreviewForm follows native form validation rules before opening the review. Forms with novalidate and submit buttons with formnovalidate can still open the review for draft-style flows, while normal invalid required fields continue to use the browser’s validation UI.

The sensitiveFields option controls what is displayed in the preview UI. It is not a sanitized security boundary for lifecycle callbacks, ReviewContext.formData, or code that directly inspects form controls.

mode: "page" is currently a page-takeover flow: it hides the original form while an overlay-style review is visible, then restores the form when the user cancels or chooses a field to edit. A true inline page renderer is planned for a future minor release.

Add field-level policy with data-preview-ignore, data-preview-label, data-preview-mask, and data-preview-section.

jQuery compatibility

Load jQuery 3.7+ or 4.x first, then load dist/jquery.iife.js:

$("#my-form").previewForm({
  title: "Please review",
  yes: "Send",
  no: "Keep editing",
  extratext: "Check your information before sending."
});

The adapter also supports open, refresh, and destroy methods. show_password: true reveals only password controls for legacy compatibility; other sensitive fields remain masked.

For ESM, import installJQueryAdapter from preview-form/jquery. It uses the jQuery instance already available on the page; it does not import or bundle jQuery itself. TypeScript users should install @types/jquery.

Development

npm install
npm run build
npm test

PreviewForm 2.0 is a clean rewrite. Historical 1.x code remains available from earlier git tags/releases; new applications should use the v2 entry points.