Forms
Das Basis-Layout einer Gruppe von Eingabefeldern wird mit dem Grund-Markup bereitgestellt. Dieses ist immer zu verwenden und gibt eine grundlegende Formatierung und Ausrichtung der Elemente vor. Dieses Grund-Markup kann mit beliebigen Elementen aus den nachfolgenden Elementen gefüllt werden. (Beispielformulare)
The basic layout of a group of input fields is provided with the basic mark-up. It should always be used and specifies the basic formatting and alignment of the elements. This basic mark-up can be filled with any of the elements in the following elements. (Exampleforms)
Table of contents
Form elements
Text
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3094" class="form-label ">
Label
</label>
<input class="form-control" id="myInputField3094" type="text" name="myInputField3094">
</div>
</form>
Select
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect5113" class="form-label">
Select
</label>
<select class="form-control" id="mySelect5113" name="mySelect5113"
>
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
</div>
</form>
Multiselect
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect3940" class="form-label">
Multiselect
</label>
<select class="form-control" multiple id="mySelect3940" name="mySelect3940"
>
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
</div>
</form>
Custom multiselect with checkboxes
<form class="form--base panel--heavy">
<div class="form-group js-multi-select">
<label id="mylabel5892" class="form-label">Label</label>
<!-- Trigger -->
<button type="button" class="multi-select__trigger" aria-expanded="false" aria-controls="mypanel5892" aria-labelledby="mylabel5892 mytext5892">
<span id="mytext5892" class="multi-select__text">Bitte wählen</span>
</button>
<!-- Text/Messages (i18n) -->
<div class="multi-select__messages" hidden>
<span data-role="placeholder">Bitte wählen</span>
<span data-role="selected">ausgewählt</span>
</div>
<!-- Dropdown Panel -->
<div class="multi-select__panel" id="mypanel5892" hidden>
<fieldset class="multi-select__options">
<legend class="aural">Label auswählen</legend>
<label class="multi-select__option">
<input type="checkbox" name="myname5892[]" value="option1">Option 1</label>
<label class="multi-select__option">
<input type="checkbox" name="myname5892[]" value="option2">Option 2</label>
<label class="multi-select__option">
<input type="checkbox" name="myname5892[]" value="option3">Option 3</label>
</fieldset>
</div>
</div>
</form>
File
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3364" class="form-label ">
Label
</label>
<input class="form-control" id="myInputField3364" type="file" name="myInputField3364">
</div>
</form>
Time
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField6524" class="form-label ">
Label
</label>
<input class="form-control" id="myInputField6524" type="time" name="myInputField6524">
</div>
</form>
Number
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4549" class="form-label ">
Label
</label>
<input class="form-control" id="myInputField4549" type="number" name="myInputField4549">
</div>
</form>
Url
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5978" class="form-label ">
Label
</label>
<input class="form-control" id="myInputField5978" type="url" name="myInputField5978">
</div>
</form>
Date
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7504" class="form-label ">
Datepicker native (input[type=date])
</label>
<input class="form-control" id="myInputField7504" type="date" name="myInputField7504">
</div>
</form>
Custom datepicker
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3377" class="form-label ">
Label
</label>
<input class="form-control datepicker" id="myInputField3377" type="text" name="myInputField3377">
</div>
</form>
Readonly
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1230" class="form-label ">
Label
</label>
<input class="form-control" readonly id="myInputField1230" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField1230">
</div>
</form>
Required
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9999" class="form-label ">
Label <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<input class="form-control" required id="myInputField9999" type="text" name="myInputField9999">
</div>
</form>
Input as plain text
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField8071" class="form-label ">
Label
</label>
<input class="form-control-plaintext" readonly id="myInputField8071" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField8071">
</div>
</form>
Checkboxes und Radio buttons
Standardmäßig werden Checkboxen und Radios untereinander angezeigt und in der Wrapper-Klasse .form-check gekapselt. Das Inputfeld hat die Klasse .form-check-input. Das Label hat die Klasse .form-check-label.
Barrierefreiheit: Bitte beachten Sie bei Eingabegruppen die Verwendung von fieldset und legend. Siehe auch: Barrierefreies Webdesign - Mit FIELDSET und LEGEND zu beschreibenden Formularbeschriftungen
<form class="form--base panel--heavy">
<fieldset >
<legend >
Checkboxes legend
</legend>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox1435" name="myCheckbox1435">
<label class="form-check-label" for="myCheckbox1435">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox5580" name="myCheckbox5580">
<label class="form-check-label" for="myCheckbox5580">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox7814" name="myCheckbox7814">
<label class="form-check-label" for="myCheckbox7814">Disabled checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox5855" name="myCheckbox5855">
<label class="form-check-label" for="myCheckbox5855">Checkbox label with a lot of text Philosophy is considered a science but it is difficult to say, when one has to compare with an ordinary science, for example biology, or chemistry.</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox5964" name="myCheckbox5964">
<label class="form-check-label" for="myCheckbox5964">Checkbox label</label>
</div>
</fieldset>
</form>
<form class="form--base panel--heavy">
<fieldset >
<legend >
Radio button legend
</legend>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox8725" name="exampleRadios">
<label class="form-check-label" for="myCheckbox8725">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox806" name="exampleRadios">
<label class="form-check-label" for="myCheckbox806">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" disabled id="myCheckbox730" name="exampleRadios">
<label class="form-check-label" for="myCheckbox730">Disabled radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox3238" name="exampleRadios">
<label class="form-check-label" for="myCheckbox3238">Radio label with a lot of text Philosophy is considered a science but it is difficult to say, when one has to compare with an ordinary science, for example biology, or chemistry.</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox3529" name="exampleRadios">
<label class="form-check-label" for="myCheckbox3529">Radio label</label>
</div>
</fieldset>
</form>
Inline Checkboxen: Checkboxen und Radios können mit der Klasse .form-check-inline horizontal gruppiert werden.
<form class="form--base panel--heavy">
<fieldset >
<legend >
Inline checkboxes legend
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox9003" name="myCheckbox9003">
<label class="form-check-label" for="myCheckbox9003">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox1872" name="myCheckbox1872">
<label class="form-check-label" for="myCheckbox1872">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox5377" name="myCheckbox5377">
<label class="form-check-label" for="myCheckbox5377">Disabled checkbox label</label>
</div>
</fieldset>
</form>
<form class="form--base panel--heavy">
<fieldset >
<legend >
Inline radio buttons legend
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox9225" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox9225">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox1010" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox1010">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" disabled id="myCheckbox558" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox558">Disabled Radio button label</label>
</div>
</fieldset>
</form>
Toggle switch
<form class="form--base panel--heavy">
<fieldset >
<legend >
Settings
</legend>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-9865" id="toggle-switch-9865" aria-label="Toggle Switch" class="toggle-switch__input" checked="checked">
<span class="toggle-switch__display" hidden>
<i class="bicon bicon-check toggle-switch__icon toggle-switch__icon--on" aria-hidden="true"></i>
<i class="bicon bicon-times toggle-switch__icon toggle-switch__icon--off" aria-hidden="true"></i>
</span>
<label class="toggle-switch__label" for="toggle-switch-9865">Receive Notifications</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-6711" id="toggle-switch-6711" aria-label="Toggle Switch" class="toggle-switch__input">
<span class="toggle-switch__display" hidden>
<i class="bicon bicon-check toggle-switch__icon toggle-switch__icon--on" aria-hidden="true"></i>
<i class="bicon bicon-times toggle-switch__icon toggle-switch__icon--off" aria-hidden="true"></i>
</span>
<label class="toggle-switch__label" for="toggle-switch-6711">Receive SMS</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-8270" id="toggle-switch-8270" aria-label="Toggle Switch" class="toggle-switch__input" disabled="disabled">
<span class="toggle-switch__display" hidden>
<i class="bicon bicon-check toggle-switch__icon toggle-switch__icon--on" aria-hidden="true"></i>
<i class="bicon bicon-times toggle-switch__icon toggle-switch__icon--off" aria-hidden="true"></i>
</span>
<label class="toggle-switch__label" for="toggle-switch-8270">Receive call (disabled)</label>
</div>
</fieldset>
</form>
Hilfetexte
Der Hilfetext hat die Klasse .formgroup__help. Standardmäßig wird er unterhalb des Eingabefeldes angezeigt. Für Screenreader wird das Eingabeelement über das Attribut aria-describedby mit dem id des Beschreibungstexte verknüpft.
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1227" class="form-label ">
Passwort
</label>
<input class="form-control" id="myInputField1227" type="password" aria-describedby="myInputField1227Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField1227">
<small id="myInputField1227Help" class="formgroup__help">We never share your email with anyone else.</small>
</div>
</form>
Validierung
Über die Klassen .is-invalid und .is-valid können Elemente farblich gekennzeichnet werden.
Ein zusätzlicher Fehlertext mit der Klasse .message.message-error bzw. .message.message-success wird unterhalb des invaliden Elementes angezeigt.
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField2983" class="form-label ">
Label
</label>
<input class="form-control is-invalid" id="myInputField2983" type="text" aria-invalid="true" aria-describedby="myInputField2983Invalid" name="myInputField2983">
<p id="myInputField2983Invalid" class="message message--error">Bitte füllen Sie dieses Feld aus.</p>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-check">
<input class="form-check-input is-invalid" type="checkbox" aria-invalid="true" aria-describedby="myCheckbox8845Invalid" id="myCheckbox8845" name="myCheckbox8845">
<label class="form-check-label" for="myCheckbox8845">Label</label>
<p id="myCheckbox8845Invalid" class="message message--error">Bitte füllen Sie dieses Feld aus.</p>
</div>
</form>
<form class="form--base panel--heavy">
<fieldset >
<legend >
Wie zufrieden sind Sie mit dieser Frage?
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input is-invalid" type="radio" aria-invalid="true" aria-describedby="myFieldset4595Invalid" id="myCheckbox1024" name="exampleRadios">
<label class="form-check-label" for="myCheckbox1024">Sehr zufrieden</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input is-invalid" type="radio" aria-invalid="true" aria-describedby="myFieldset4595Invalid" id="myCheckbox5661" name="exampleRadios">
<label class="form-check-label" for="myCheckbox5661">Ist mir egal</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input is-invalid" type="radio" aria-invalid="true" aria-describedby="myFieldset4595Invalid" id="myCheckbox6296" name="exampleRadios">
<label class="form-check-label" for="myCheckbox6296">Weniger zufrieden</label>
</div>
<p class="message message--error" id="myFieldset4595Invalid">Bitte füllen Sie dieses Feld aus.</p>
</fieldset>
</form>
Horizontale Elemente
Horizontale Darstellung von Elementen mit .form-group--inline.
<form class="form--base panel--heavy">
<div class="form-group form-group form-group--inline">
<div class="form-group">
<label for="myInputField9808" class="form-label aural">
Label
</label>
<input class="form-control" id="myInputField9808" type="text" name="myInputField9808">
</div>
<div class="form-group">
<label for="mySelect6031" class="form-label aural">
Label
</label>
<select class="form-control" id="mySelect6031" name="mySelect6031"
>
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox8119" name="myCheckbox8119">
<label class="form-check-label" for="myCheckbox8119">Label</label>
</div>
<button type="submit" class="button">Button</button>
</div>
</form>
.form-group--inline .fullspace .align-bottom
<form class="form--base panel--heavy">
<div class="form-group form-group form-group--inline fullspace align-bottom">
<div class="form-group">
<label for="myInputField8418" class="form-label ">
Label
</label>
<input class="form-control" id="myInputField8418" type="text" name="myInputField8418">
</div>
<div class="form-group">
<label for="myInputField5343" class="form-label ">
Label
</label>
<input class="form-control" id="myInputField5343" type="text" name="myInputField5343">
</div>
<button type="submit" class="button">Button</button>
</div>
</form>
Beispiel 1
<form class="form--base panel--heavy">
<p class="form-description">
Hinweis: Pflichtfelder sind mit einem <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span> markiert.
</p>
<div class="form-group">
<label for="myInputField3999" class="form-label ">
Input <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<input class="form-control" required id="myInputField3999" type="text" aria-describedby="myInputField3999Help " name="myInputField3999">
<small id="myInputField3999Help" class="formgroup__help">Helptext</small>
</div>
<div class="form-group">
<label for="mySelect5327" class="form-label">
Select <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<select class="form-control" required id="mySelect5327" aria-describedby="mySelect5327Help " name="mySelect5327"
>
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<small id="mySelect5327Help" class="formgroup__help">Helptext</small>
</div>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox9728" name="myCheckbox9728">
<label class="form-check-label" for="myCheckbox9728">Antwort 1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox5745" name="myCheckbox5745">
<label class="form-check-label" for="myCheckbox5745">Antwort 2</label>
</div>
</fieldset>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox4516" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox4516">Ja</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox2525" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox2525">Nein</label>
</div>
</fieldset>
<div class="form-actions"> <div class="form-actions__left">
<a href="#randomtarget7968" class="link--back">Back</a>
</div>
<div class="form-actions__right">
<button type="submit" class="button">Action</button>
</div>
</div>
<div class="form__footer panel__footer panel--heavy">
<p>Optionaler Footer</p>
</div>
</form>
Beispiel 2: Login mit Fehlermeldung
<div role="alert" class="message message--error">
<h3 class="title"><i class="bicon bicon-times-circle" aria-hidden="true"></i>Anmeldung fehlgeschlagen</h3>
<ul><li>E-Mail-Adresse oder Passwort sind nicht korrekt.</li></ul>
</div>
<form class="form--base panel--heavy">
<p class="form-description">
Hinweis: Pflichtfelder sind mit einem <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span> markiert.
</p>
<div class="form-group">
<label for="myInputField9566" class="form-label ">
E-Mail-Adresse <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<input class="form-control" required id="myInputField9566" type="email" value="meine@email.adresse" autocomplete="username" name="myInputField9566">
</div>
<div class="form-group">
<label for="myInputField5413" class="form-label ">
Passwort <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<input class="form-control" required id="myInputField5413" type="password" autocomplete="current-password" name="myInputField5413">
</div>
<div class="form-actions">
<button type="submit" class="button">Anmelden</button>
</div>
<div class="mytop-1">
<a href="#randomtarget4096">Passwort zurücksetzen</a>
</div>
</form>
Beispiel 3: Registrierung mit Fehlermeldung
<div role="alert" class="message message--error">
<h2 class="title"><i class="bicon bicon-times-circle" aria-hidden="true"></i>Das Konto konnte nicht erstellt werden</h2>
<ul>
<li>
<a href="#password">Die Passwörter stimmen nicht überein. Bitte geben Sie beide Passwörter erneut ein.</a>
</li>
<li>
<a href="#consent">Bitte stimmen Sie der Datenschutzerklärung zu.</a>
</li>
</ul>
</div>
<form class="form--base panel--heavy">
<p class="form-description">
Hinweis: Pflichtfelder sind mit einem <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span> markiert.
</p>
<div class="form-group">
<label for="email" class="form-label ">
E-Mail-Adresse <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<input class="form-control" required id="email" type="email" value="meine@email.adresse" autocomplete="username" name="email">
</div>
<div class="form-group">
<label for="password" class="form-label ">
Passwort <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<input class="form-control is-invalid" required id="password" type="password" autocomplete="new-password" name="password">
</div>
<div class="form-group">
<label for="confirmPassword" class="form-label ">
Passwort wiederholen <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<input class="form-control is-invalid" required id="confirmPassword" type="password" autocomplete="new-password" name="confirmPassword">
</div>
<div class="form-check">
<input class="form-check-input is-invalid" type="checkbox" aria-invalid="true" aria-describedby="consentInvalid" required id="consent" name="consent">
<label class="form-check-label text--small" for="consent">Ich habe die <a href="#" target="_blank" class="extern">Datenschutzerklärung<span class="aural"> (öffnet in neuem Fenster)</span></a> gelesen und willige in die Speicherung und Nutzung meiner Daten ein. <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span></label>
<p id="consentInvalid" class="message message--error">Bitte stimmen Sie der Datenschutzerklärung zu.</p>
</div>
<div class="form-actions">
<button type="submit" class="button">Konto erstellen</button>
</div>
</form>