lion/packages/fieldset
Joren Broekema e3554c146f
Merge pull request #1225 from ing-bank/chore/update-cem
chore: update CEM version, add litelement flag
2021-02-17 17:25:18 +01:00
..
docs/helpers feat: merge field/validate/choice-input/form-group into @lion/form-core 2020-05-29 17:01:15 +02:00
src fix: types base constructor same return type 2021-01-13 17:05:07 +01:00
test fix: assure proper typings _inputNode across lion fields 2020-10-01 10:02:45 +02:00
CHANGELOG.md Version Packages 2021-02-17 10:19:23 +00:00
index.js feat: merge field/validate/choice-input/form-group into @lion/form-core 2020-05-29 17:01:15 +02:00
lion-fieldset.js feat: release inital public lion version 2019-04-26 10:37:57 +02:00
package.json Merge pull request #1225 from ing-bank/chore/update-cem 2021-02-17 17:25:18 +01:00
README.md fix: minimise deps by moving integration demos to integration packages 2021-01-06 16:34:03 +01:00

Fieldset

lion-fieldset groups multiple input fields or other fieldsets together.

import { html } from '@lion/core';
import '@lion/input/lion-input.js';
import { localize } from '@lion/localize';
import { MinLength, Validator, Required } from '@lion/form-core';
import './lion-fieldset.js';
import './docs/helpers/demo-fieldset-child.js';

export default {
  title: 'Forms/Fieldset/Overview',
};

We have three specific fieldset implementations:

export const main = () => html`
  <lion-fieldset name="nameGroup" label="Name">
    <lion-input name="FirstName" label="First Name"></lion-input>
    <lion-input name="LastName" label="Last Name"></lion-input>
  </lion-fieldset>
`;

A native fieldset element should always have a legend-element for a11y purposes. However, our fieldset element is not native and should not have a legend-element. Our fieldset instead has a label attribute or you can add a label with a div- or heading-element using slot="label".

Features

  • Easy retrieval of form data based on field names
  • Advanced user interaction scenarios via interaction states
  • Can have validate on fieldset level and shows the validation feedback below the fieldset
  • Can disable input fields on fieldset level
  • Accessible out of the box

How to use

Installation

npm i --save @lion/fieldset
import { LionFieldset } from '@lion/fieldset';
// or
import '@lion/fieldset/lion-fieldset.js';

Example

<lion-fieldset name="personalia" label="personalia">
  <lion-input name="title" label="Title"></lion-input>
</lion-fieldset>

For more examples please look at Fieldset Examples.