Form

A form allows the user to input data.

Usage

When to use

Use a form in the following cases:

  • Use forms to collect information from the user.

General construction

A form consists of the following elements:

form-usage-general-construction
1. Fieldset, 2. UI elements, 3. Required field and indicator, 4. Submit buttons

form-usage-general-construction
3. Optional field indicator

1. Fieldset

  • A fieldset visually groups related form elements. For further information, see chapter Fieldset.

2. UI elements

  • UI elements are disabled if not currently needed.
  • Various UI elements are described in the types section below.

3. Required field / optional field and indicator

  • Mandatory input fields are marked with an asterisk.
  • If the majority of user inputs are required, tag only the optional ones with an additional optional label.
  • Stay consistent with one rule within one app.

4. Submit buttons

  • Use a primary button for the main action and a secondary or ghost button for alternative actions.
  • The submit buttons under a form should be left aligned with the primary button at first.
  • For further information, see chapter Button.

Layout

Arrange input controls in one column. User inputs that are directly related may be placed next to each other. For example postal code and city.

form-usage-layout
Example with inputs that are placed next to each other

Progressive disclosure

Keep the form as simple as possible. Reveal more input controls only when they are needed.

Types

There are the following UI element types:

Text input controls

Text input elements have a top aligned label. They can also have an optional placeholder text and a description.

Single text input

Use a single text input to limit the amount of text to enter. You should specify the expected format in the title, such as number or email address.

form-usage-text-field
Single text input

Textarea

A textarea is a multiline text input that allows the user to enter long text.

form-usage-textarea
Textarea

Selection controls

Checkbox

Use a checkbox group to allow users to select no, one or more options. The group label informs the user about the topic of the group. The checkbox label informs the user what will happen if the box is checked. Checkboxes and the checkbox group can have a description text for explanation.

form-usage-checkbox
Checkbox group

Radio button

Use a radio button group when you want the user to select a single option from a short list. If you have more then ten options, consider using a select instead. Use a description text to give more explanation.

form-usage-radio
Radio button group

Switch

Use a switch to visualize the selection of binary states, for example “On” or “Off”.

form-usage-switch
Switch

Use a drop-down list to let the user choose from a set of multiple choices.

form-usage-select
Drop-down list

Behavior

Form validation is explained in the chapter Form validation.

Do’s & Don’ts

form-usage-do-label

  • Use labels to give input controls a title.
  • Never label input fields inside the placeholder text. With user input the placeholder text is hidden.

form-usage-do-fieldlength

  • Fit the field size to the expected content.
  • Don’t use one field size for all input formats.

Style

This chapter shows form styles in the MindSphere Design System.

Overview

forms-style-overview
Form example

Also see chapter Form validation and Typography for the use of the different font sizes and font styles.

Sizing and spacing

The following measurements show the dimensions for forms:

Type Property Spacing
Input controls margin-bottom 16px
Form submit actions margin-bottom 16px
Additional whitespace for visual separation of unrelated controls margin-bottom + 8px

forms-style-spacings
Form spacing

Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.
Back to top