1.8.1 • Published 10 months ago

@finastra/form v1.8.1

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

Form

fds-form is a component used to collect user input from fds interactive controls such as : fds-textfield, fds-select, fds-checkbox ...

The form fields that have constraints defined will be automatically validated when the fds form is submitted and a default error message will be shown for any invalid form field.

See it on NPM! How big is this package in your project? Storybook

Usage

Import

npm i @finastra/form
import '@finastra/form';
...
  <fds-form id="myForm">
      <fds-textfield required label="Name" placeholder="Name" validationMessage="required field"></fds-textfield>
      <fds-textarea
        required
        label="Bio"
        helper="You can @mention other users and organizations to link to them."
        charcounter="true"
        maxlength="18"
        validationMessage="required field"
        helperPersistent
      ></fds-textarea>

      <div class="actions">
        <fds-button type="submit" label="submit"></fds-button>
        <fds-outlined-button type="reset" label="reset"></fds-outlined-button>
      </div>
  </fds-form>

API

Methods

MethodType
getFormData(): FormData
getFormElements(): any[]
handleClick(event: MouseEvent): boolean
reportValidity(): boolean
reset(): void
submit(): boolean

Events

EventDescription
formResetEmitted when the form is reset.
formSubmitEmitted when the form is submitted.