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)
Form elements
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField8410" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField8410" type="text" name="myInputField8410">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect3558" class="form-label">
Select
</label>
<select class="form-control" id="mySelect3558" name="mySelect3558"
>
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect8904" class="form-label">
Multiselect
</label>
<select class="form-control" multiple id="mySelect8904" name="mySelect8904"
>
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group js-multi-select">
<label id="mylabel169" class="form-label">JS Multiselect</label>
<!-- Trigger -->
<button type="button" class="multi-select__trigger" aria-expanded="false" aria-controls="mypanel169" aria-labelledby="mylabel169 mytext169">
<span id="mytext169" 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="mypanel169" hidden>
<fieldset class="multi-select__options">
<legend class="aural">JS Multiselect auswählen</legend>
<label class="multi-select__option">
<input type="checkbox" name="myname169[]" value="option1">Option 1</label>
<label class="multi-select__option">
<input type="checkbox" name="myname169[]" value="option2">Option 2</label>
<label class="multi-select__option">
<input type="checkbox" name="myname169[]" value="option3">Option 3</label>
</fieldset>
</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1003" class="form-label ">
Dateiupload
</label>
<input class="form-control" id="myInputField1003" type="file" name="myInputField1003">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField6689" class="form-label ">
Time
</label>
<input class="form-control" id="myInputField6689" type="time" name="myInputField6689">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3212" class="form-label ">
Number
</label>
<input class="form-control" id="myInputField3212" type="number" name="myInputField3212">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7006" class="form-label ">
Url
</label>
<input class="form-control" id="myInputField7006" type="url" name="myInputField7006">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3492" class="form-label ">
Datepicker native (input[type=date])
</label>
<input class="form-control" id="myInputField3492" type="date" name="myInputField3492">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5545" class="form-label ">
Datepicker with flatpickr.js (input.datepicker)
</label>
<input class="form-control datepicker" id="myInputField5545" type="text" name="myInputField5545">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField2060" class="form-label ">
Readonly
</label>
<input class="form-control" readonly id="myInputField2060" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField2060">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4056" class="form-label ">
Required <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<input class="form-control" required aria-required="true" id="myInputField4056" type="text" name="myInputField4056">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4578" class="form-label ">
Input as plaintext
</label>
<input class="form-control-plaintext" readonly id="myInputField4578" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField4578">
</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="myCheckbox5875" name="myCheckbox5875">
<label class="form-check-label" for="myCheckbox5875">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox5063" name="myCheckbox5063">
<label class="form-check-label" for="myCheckbox5063">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox8188" name="myCheckbox8188">
<label class="form-check-label" for="myCheckbox8188">Disabled checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox4414" name="myCheckbox4414">
<label class="form-check-label" for="myCheckbox4414">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="myCheckbox932" name="myCheckbox932">
<label class="form-check-label" for="myCheckbox932">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="myCheckbox3426" name="exampleRadios">
<label class="form-check-label" for="myCheckbox3426">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox2080" name="exampleRadios">
<label class="form-check-label" for="myCheckbox2080">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" disabled id="myCheckbox875" name="exampleRadios">
<label class="form-check-label" for="myCheckbox875">Disabled radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox5312" name="exampleRadios">
<label class="form-check-label" for="myCheckbox5312">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="myCheckbox1973" name="exampleRadios">
<label class="form-check-label" for="myCheckbox1973">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="myCheckbox5162" name="myCheckbox5162">
<label class="form-check-label" for="myCheckbox5162">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox9586" name="myCheckbox9586">
<label class="form-check-label" for="myCheckbox9586">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox6407" name="myCheckbox6407">
<label class="form-check-label" for="myCheckbox6407">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="myCheckbox8539" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox8539">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox5372" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox5372">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" disabled id="myCheckbox5168" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox5168">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-6224" id="toggle-switch-6224" 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-6224">Receive Notifications</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-1933" id="toggle-switch-1933" 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-1933">Receive SMS</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-3465" id="toggle-switch-3465" 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-3465">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="myInputField1075" class="form-label ">
Passwort
</label>
<input class="form-control" id="myInputField1075" type="password" aria-describedby="myInputField1075Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField1075">
<small id="myInputField1075Help" 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="myInputField2370" class="form-label ">
Textfeld
</label>
<input class="form-control is-invalid" id="myInputField2370" type="text" aria-invalid="true" aria-describedby="myInputField2370Invalid " name="myInputField2370">
<p id="myInputField2370Invalid" 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="myCheckbox2671Invalid " id="myCheckbox2671" name="myCheckbox2671">
<label class="form-check-label" for="myCheckbox2671">Checkbox</label>
<p id="myCheckbox2671Invalid" 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="myFieldset2625Invalid" id="myCheckbox6217" name="exampleRadios">
<label class="form-check-label" for="myCheckbox6217">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="myFieldset2625Invalid" id="myCheckbox49" name="exampleRadios">
<label class="form-check-label" for="myCheckbox49">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="myFieldset2625Invalid" id="myCheckbox4826" name="exampleRadios">
<label class="form-check-label" for="myCheckbox4826">Weniger zufrieden</label>
</div>
<p class="message message--error" id="myFieldset2625Invalid">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="myInputField6097" class="form-label aural">
Textfeld
</label>
<input class="form-control" id="myInputField6097" type="text" name="myInputField6097">
</div>
<div class="form-group">
<label for="mySelect7885" class="form-label aural">
Auswahlliste
</label>
<select class="form-control" id="mySelect7885" name="mySelect7885"
>
<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="myCheckbox9078" name="myCheckbox9078">
<label class="form-check-label" for="myCheckbox9078">Checkbox</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="myInputField851" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField851" type="text" name="myInputField851">
</div>
<div class="form-group">
<label for="myInputField9011" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField9011" type="text" name="myInputField9011">
</div>
<button type="submit" class="button">Button</button>
</div></form>
Example 1
<form class="form--base panel--heavy">
<p class="form-description">
Hinweis: Pflichfelder sind mit einem <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span> markiert.
</p>
<div class="form-group">
<label for="myInputField4625" class="form-label ">
Input <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<input class="form-control" required aria-required="true" id="myInputField4625" type="text" aria-describedby="myInputField4625Help " name="myInputField4625">
<small id="myInputField4625Help" class="formgroup__help">Helptext</small>
</div>
<div class="form-group">
<label for="mySelect8184" class="form-label">
Select <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<select class="form-control" required aria-required="true" id="mySelect8184" aria-describedby="mySelect8184Help " name="mySelect8184"
>
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<small id="mySelect8184Help" 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="myCheckbox4745" name="myCheckbox4745">
<label class="form-check-label" for="myCheckbox4745">Antwort 1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox7534" name="myCheckbox7534">
<label class="form-check-label" for="myCheckbox7534">Antwort 2</label>
</div>
</fieldset>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox4140" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox4140">Ja</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox8817" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox8817">Nein</label>
</div>
</fieldset>
<div class="form-actions"> <div class="form-actions__left">
<a href="#randomtarget3652" 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>
Example 2
Dieser Bereich ist geschützt. Bitte geben Sie Ihren Benutzernamen und Ihr Passwort ein.
<form class="form--base panel--heavy">
<p class="form-description">
Hinweis: Pflichfelder sind mit einem <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span> markiert.
</p>
<div class="form-group">
<label for="myInputField6872" class="form-label ">
Benutzername <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<input class="form-control" required aria-required="true" id="myInputField6872" type="text" name="myInputField6872">
</div>
<div class="form-group">
<label for="myInputField2173" class="form-label ">
Passwort <span class="icon-required" aria-hidden="true">*</span><span class="aural">(Pflichtfeld)</span>
</label>
<input class="form-control" required aria-required="true" id="myInputField2173" type="password" name="myInputField2173">
</div>
<div class="form-actions">
<button type="submit" class="button">Anmelden</button>
</div>
</form>