beta This component version is ready to be used but is still in active development.

Fieldset github location npm version

The vf-form__fieldset is used to group a set related form inputs.


Variants


Usage

Use the vf-form__fieldset component to display a relationship between multiple form inputs. You can also need use a vf-form__fieldset inside of another vf-form__fieldset, this would be good to group multiple vf-form__checkbox inputs and allow for a vf-form__legend to give the inputs a heading or question. To make it more obvious what we are asking the site visitor to fill out and why, it is recommened to use a vf-form__legend within each vf_form__fieldset.

A Fieldset Legend
Nunjucks syntax

Depending on your environment you'll want to use render or include. As a rule of thumb: server-side use include, precompiled browser use render. If you're using vf-eleventy you should use include.

Using include

You'll need to pass a context object from your code or Yaml file (example), as well as the path to the Nunjucks template. Nunjucks' include is an abstraction of render and provides some additional portability.


{% set context fromYourYamlFile %}
- or -
{% set context = {
  "component-type": "form",
  "fieldset_legend": {
    "legend__text": "A Fieldset Legend"
  }
}
 %}
{% include "../path_to/vf-form__fieldset/vf-form__fieldset.njk" %}
                

Using render

This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include is not be available.

{% render '@vf-form__fieldset', {
  "component-type": "form",
  "fieldset_legend": {
    "legend__text": "A Fieldset Legend"
  }
} %}
                
HTML
<fieldset class="vf-form__fieldset | vf-stack vf-stack--400">
  <legend class="vf-form__legend">A Fieldset Legend</legend>
</fieldset>
              
Another Fieldset Legend

Something has gone terribly wrong.

Nunjucks syntax

Depending on your environment you'll want to use render or include. As a rule of thumb: server-side use include, precompiled browser use render. If you're using vf-eleventy you should use include.

Using include

You'll need to pass a context object from your code or Yaml file (example), as well as the path to the Nunjucks template. Nunjucks' include is an abstraction of render and provides some additional portability.


{% set context fromYourYamlFile %}
- or -
{% set context = {
  "component-type": "form",
  "fieldset__error": {
    "error": true,
    "helper_text": "Something has gone terribly wrong."
  },
  "fieldset_legend": {
    "legend__text": "Another Fieldset Legend"
  }
}
 %}
{% include "../path_to/vf-form__fieldset/vf-form__fieldset.njk" %}
                

Using render

This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include is not be available.

{% render '@vf-form__fieldset', {
  "component-type": "form",
  "fieldset__error": {
    "error": true,
    "helper_text": "Something has gone terribly wrong."
  },
  "fieldset_legend": {
    "legend__text": "Another Fieldset Legend"
  }
} %}
                
HTML
<fieldset class="vf-form__fieldset | vf-stack vf-stack--400">
  <legend class="vf-form__legend">Another Fieldset Legend</legend>

  <p class="vf-form__helper vf-form__helper--error">Something has gone terribly wrong.</p>
</fieldset>
              
Installation info

This repository is distributed with [npm][https://www.npmjs.com/]. After [installing npm][https://www.npmjs.com/get-npm] and yarn, you can install vf-form__fieldset with this command.

$ yarn add --dev @visual-framework/vf-form__fieldset

Changelog

Changelog

1.1.2

  • Implements updated vf-search markup.
  • Changes a few pages on how it works with nunjucks and markdown.

1.1.0

  • updates Design Tokens homepage.
  • adds neutral colour tokens
  • adds 'status banners' for components in the documentation page.
  • Adds the form options as their own set of components in the list.
  • https://github.com/visual-framework/vf-core/pull/1390/files
  • Updates to use 11ty 0.12.1
  • https://github.com/visual-framework/vf-core/pull/1435

1.0.24

  • changes the vf-intro so it's a white background, removes the padding.
  • changes the links in vf-intro to be the 'correct' buttons.

1.0.23

  • small change to cards on homepage

1.0.18

  • dependency bump

1.0.17

  • dependency bump

1.0.16

  • dependency bump

1.0.13

  • dependency bump
  • adds roamap and consultation docs

1.0.12

  • design token documenation now lives in the component libary

1.0.7

  • adds updates blog

1.0.6

  • begin to make more pattern/boilerplate guidance
  • minor templating updates

1.0.5

  • dependency bump

1.0.4

  • uses vf-favicon
  • adds meta attributes

1.0.3

  • run vf-component-assets:everything on local dev
  • remove reference to removed /css/app.css

1.0.2

  • Add 404
  • Fix component CSS generation

1.0.1

  • Also generate per-component CSS with vf-css:generate-component-css

1.0.0

  • Initial release to be used with vf-core 2.2.0

Assets



File system location: components/vf-form__fieldset

Find an issue on this page? Propose a change or discuss it.