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

elp-form

v1.0.5

Published

Easier to build Form based on element-plus

Readme

English | 中文

🚀 Features

  • Layout: Through the layoutConfig list configuration, you can customize the layout of the form row, col
  • 🐱 Component basic attributes are retained: Keep all the attribute configuration of the element-plus Form, Input and other components, flexibly configure the attributes of a single form item
  • 🎈 Form input verification: Through the rules configuration, you can customize the form verification rules, support all rules of element-plus Form
  • 🥏 Built-in submission and reset: Submit the form with one click, reset the form with one click
  • 🚩 Slots and hooks: Through the hooks property and the slots property, you can customize the form slots and hooks

📦 Install

npm install elp-form
or
pnpm add elp-form
or
yarn add elp-form

🦄 Usage

import { ElpForm } from "elp-form";

<ElpForm
  :formItems="formItems"
  :rules="rules"
  :submitLoading="submitLoading"
  :layoutConfig="layoutConfig"
  @resetForm="resetForm"
  @search="search"
  />

Configuration: formItems(required)

  • Support component types: input, select, switch, TimeSelect, inputNumber, radio, upload
const formItems =  reactive([
  {
    label?: string;,  /** Form label text `optional` */
    type: string, /** Form label type(input,select,date) `required` */
    value:string,  /** Form label binding value `required` */
    defaultValue?: string, /** Form label default value `optional` */
    attribute: {
      placeholder?: string, /** Form label placeholder `optional` */
      maxlength?: number, /** Form label maximum length `optional` */
      ... /** Form label other attributes `optional` */
    },
    rowIndex?: number, /** Form label row index, can be controlled by layoutConfig `optional` */
    hook?: {
      change?: (value: any) => void, /** Form label change event `optional` */
      ... /** Form label other hooks `optional` */
    },
    slots?: {
      prepend?: string, /** Form label prepend slot `optional` */
      append?: string, /** Form label append slot `optional` */
      ... /** Form label other slots `optional` */
    },
  },
  ...

]);

Configuration: submitLoading(optional)

  • Loading status when submitting the form
import { ref } from "vue";
const submitLoading = ref(false);

Configuration: rules(optional)

  • Verify whether the user's input meets the specifications (same as element-plus rules)
import { reactive, ref } from "vue";
import type { FormInstance, FormRules } from "element-plus";
const rules = reactive<FormRules>({
  name: [
    { required: true, message: "Please input Activity name", trigger: "blur" },
    { min: 3, max: 5, message: "Length should be 3 to 5", trigger: "blur" }
  ]
});

Configuration: layoutConfig(optional)

  • Configure the form layout
  • rowAttr is the same as element-plus layout-row
  • colAttr is the same as element-plus layout-col
const layoutConfig = [
  {
    rowAttr: {
      gutter: 0 /** Row attribute `optional` */
      ... /** Row attribute `optional` */
    },
    cols: [
      {
        rowIndex: 0, /** Corresponding rowindex of formItems `required` */
        colAttr: {
          span: 8 /** Column attribute `optional` */
          ... /** Column attribute `optional` */
        }
      },
      ...
    ]
  },
  ...
];

Configuration: hooks(optional)

  • Configure the form hook function to provide all the hook functions of the component
  • Through the hooks property, you can customize the form component hook
const formItems = reactive([
{
  label?: string;,  /** Form label text `optional` */
  type: 'switch', /** Form label type(input,select,date) `required` */
  ...,
  hooks: {
    change: (val: any) => {
      console.log('switch11', val)
      ElMessage({
        message: val ? '开' : '关',
        type: 'success',
      })
    },
  },
  ...
},
...
]);

Configuration: slots(optional)

  • Configure the form slot function to provide all the slot functions of the component
  • Through the slots property, you can customize the form component slot
const formItems = reactive([
{
  label?: string;,  /** Form label text `optional` */
  type: 'input', /** Form label type(input,select,date) `required` */
  ...,
  slots: {
    prepend: () => {
      return <span>prepend</span>
    },
    append: () => {
      return <span>append</span>
    },
  },
  ...
},
...
]);