Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lion/form-core

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lion/form-core

Form-core contains all essential building blocks for creating form fields and fieldsets

  • 0.17.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3K
increased by4.01%
Maintainers
1
Weekly downloads
 
Created
Source

Systems >> Form >> Overview ||10

This page should be used as a starting point when first using the Form System. It provides an overview of its essential building blocks and provides links to detailed explanations of most of its core concepts.

Building Blocks

Our Form System is built from a set of very fundamental building blocks: form controls, fields and fieldsets.

Form Controls

Form controls are the most fundamental building blocks of our Form System. They are the fundament of both fields, and fieldsets and provide a normalized, predictable API throughout the whole form. Every form element inherits from FormControlMixin.

FormControlMixin creates the default html structure and accessibility is designed to be used in conjunction with the ValidateMixin and the FormatMixin.

Fields

Fields (think of an input, textarea, select) are the actual form controls the end user interacts with. They extend LionField, which in turn uses the FormControlMixin. Fields provide a normalized API for both platform components and custom made form controls.

On top of this, they feature:

  • formatting/parsing/serializing of view values.
  • Advanced validation possibilities.
  • Creation of advanced user interaction scenarios via interaction states.
  • Provision of labels and help texts in an easy, declarative manner.
  • Accessibility out of the box.
  • Advanced styling possibilities: map your own Design System to the internal HTML structure. Form controls are the most fundamental building block of the Forms. They are the basis of both fields and fieldsets, and the form itself.

Platform fields (wrappers)

Custom fields (wrappers)

Whenever a native form control doesn't exist or is not sufficient, a custom form field should be created. One could think of components like:

Choice Input Fields

For form controls which return a checked-state you can use the lion-choice-input mixin. It is used in:

  • LionCheckbox, a wrapper for <input type="checkbox">.
  • LionOption, an alternative for <option>.
  • LionRadio, a wrapper for <input type="radio">.
  • LionSwitch, a custom implementation of a switch.

Which contains the following features:

  • Get or set the value of the choice - choiceValue().
  • Get or set the modelValue (value and checked-state) of the choice - .modelValue.
  • Pre-select an option by setting the checked boolean attribute.

Fieldsets

Fieldsets are groups of fields. They can be considered fields on their own as well, since they partly share the normalized API via FormControlMixin. Fieldsets are the basis for:

  • LionFieldset, a wrapper around multiple input fields or other fieldsets.
  • LionForm, enhances the functionality of the native <form> component.
  • LionCheckboxGroup, a wrapper component for multiple checkboxes.
  • LionRadioGroup, a wrapper component for multiple radio inputs.

Other Resources

Keywords

FAQs

Package last updated on 09 May 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc