jattac.libs.popup-menu
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

FormField React Component

FormField is a powerful React component designed to streamline the creation of form fields with built-in support for validation, labels, hints, and optional indicators.

Installation

npm install jattac.libs.web.form-field

Example

import React from 'react';
import FormField from 'jattac.libs.web.form-field';

const MyForm = () => {
  const validationErrors = [
    // Your validation errors here
  ];

  return (
    <form>
      <FormField
        label="Email"
        id="email"
        validationErrors={[{ key: 'email', errors: ['Invalid email address'] }]}
        optional={true}
        hint="We'll never share your email with anyone else."
      >
        <input type="email" />
      </FormField>

      {/* Add more FormField components for other form elements */}
    </form>
  );
};

Props

  • label (required): The label for the form field.
  • id (required): A unique identifier for the form field.
  • children (required): The content of the form field, typically an input element.
  • validationErrors: An array of validation errors for the form field.
  • optional: A boolean indicating whether the field is optional. Defaults to false.
  • hint: Additional information or guidance for the form field.

Readme

Keywords

Package Sidebar

Install

npm i jattac.libs.popup-menu

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

27.8 kB

Total Files

19

Last publish

Collaborators

  • nyingi