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="myInputField1737" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField1737" type="text" name="myInputField1737">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect3534" class="form-label">
Select
</label>
<select class="form-control" id="mySelect3534" name="mySelect3534"
>
<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="mySelect415" class="form-label">
Multiselect
</label>
<select class="form-control" multiple id="mySelect415" name="mySelect415"
>
<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="mylabel2397" class="form-label">JS Multiselect</label>
<!-- Trigger -->
<button type="button" class="multi-select__trigger" aria-expanded="false" aria-controls="mypanel2397" aria-labelledby="mylabel2397 mytext2397">
<span id="mytext2397" 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="mypanel2397" hidden>
<fieldset class="multi-select__options">
<legend class="aural">JS Multiselect auswählen</legend>
<label class="multi-select__option">
<input type="checkbox" name="myname2397[]" value="option1">Option 1</label>
<label class="multi-select__option">
<input type="checkbox" name="myname2397[]" value="option2">Option 2</label>
<label class="multi-select__option">
<input type="checkbox" name="myname2397[]" value="option3">Option 3</label>
</fieldset>
</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField575" class="form-label ">
Dateiupload
</label>
<input class="form-control" id="myInputField575" type="file" name="myInputField575">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField8162" class="form-label ">
Time
</label>
<input class="form-control" id="myInputField8162" type="time" name="myInputField8162">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4840" class="form-label ">
Number
</label>
<input class="form-control" id="myInputField4840" type="number" name="myInputField4840">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField8323" class="form-label ">
Url
</label>
<input class="form-control" id="myInputField8323" type="url" name="myInputField8323">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7740" class="form-label ">
Datepicker native (input[type=date])
</label>
<input class="form-control" id="myInputField7740" type="date" name="myInputField7740">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField8924" class="form-label ">
Datepicker with flatpickr.js (input.datepicker)
</label>
<input class="form-control datepicker" id="myInputField8924" type="text" name="myInputField8924">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField6733" class="form-label ">
Readonly
</label>
<input class="form-control" readonly id="myInputField6733" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField6733">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField6857" 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="myInputField6857" type="text" name="myInputField6857">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField2826" class="form-label ">
Input as plaintext
</label>
<input class="form-control-plaintext" readonly id="myInputField2826" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField2826">
</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="myCheckbox1641" name="myCheckbox1641">
<label class="form-check-label" for="myCheckbox1641">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox3825" name="myCheckbox3825">
<label class="form-check-label" for="myCheckbox3825">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox6401" name="myCheckbox6401">
<label class="form-check-label" for="myCheckbox6401">Disabled checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox4583" name="myCheckbox4583">
<label class="form-check-label" for="myCheckbox4583">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="myCheckbox6241" name="myCheckbox6241">
<label class="form-check-label" for="myCheckbox6241">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="myCheckbox6376" name="exampleRadios">
<label class="form-check-label" for="myCheckbox6376">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox8303" name="exampleRadios">
<label class="form-check-label" for="myCheckbox8303">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" disabled id="myCheckbox4452" name="exampleRadios">
<label class="form-check-label" for="myCheckbox4452">Disabled radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox8166" name="exampleRadios">
<label class="form-check-label" for="myCheckbox8166">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="myCheckbox9750" name="exampleRadios">
<label class="form-check-label" for="myCheckbox9750">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="myCheckbox6807" name="myCheckbox6807">
<label class="form-check-label" for="myCheckbox6807">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox8245" name="myCheckbox8245">
<label class="form-check-label" for="myCheckbox8245">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox9269" name="myCheckbox9269">
<label class="form-check-label" for="myCheckbox9269">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="myCheckbox9178" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox9178">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox9930" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox9930">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" disabled id="myCheckbox8235" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox8235">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-3287" id="toggle-switch-3287" 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-3287">Receive Notifications</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-4544" id="toggle-switch-4544" 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-4544">Receive SMS</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-1220" id="toggle-switch-1220" 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-1220">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="myInputField145" class="form-label ">
Passwort
</label>
<input class="form-control" id="myInputField145" type="password" aria-describedby="myInputField145Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField145">
<small id="myInputField145Help" 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="myInputField4812" class="form-label ">
Textfeld
</label>
<input class="form-control is-invalid" id="myInputField4812" type="text" aria-invalid="true" aria-describedby="myInputField4812Invalid " name="myInputField4812">
<p id="myInputField4812Invalid" 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="myCheckbox5874Invalid " id="myCheckbox5874" name="myCheckbox5874">
<label class="form-check-label" for="myCheckbox5874">Checkbox</label>
<p id="myCheckbox5874Invalid" 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="myFieldset1428Invalid" id="myCheckbox8204" name="exampleRadios">
<label class="form-check-label" for="myCheckbox8204">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="myFieldset1428Invalid" id="myCheckbox7352" name="exampleRadios">
<label class="form-check-label" for="myCheckbox7352">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="myFieldset1428Invalid" id="myCheckbox7028" name="exampleRadios">
<label class="form-check-label" for="myCheckbox7028">Weniger zufrieden</label>
</div>
<p class="message message--error" id="myFieldset1428Invalid">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="myInputField9226" class="form-label aural">
Textfeld
</label>
<input class="form-control" id="myInputField9226" type="text" name="myInputField9226">
</div>
<div class="form-group">
<label for="mySelect1541" class="form-label aural">
Auswahlliste
</label>
<select class="form-control" id="mySelect1541" name="mySelect1541"
>
<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="myCheckbox366" name="myCheckbox366">
<label class="form-check-label" for="myCheckbox366">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="myInputField86" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField86" type="text" name="myInputField86">
</div>
<div class="form-group">
<label for="myInputField7834" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField7834" type="text" name="myInputField7834">
</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="myInputField381" 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="myInputField381" type="text" aria-describedby="myInputField381Help " name="myInputField381">
<small id="myInputField381Help" class="formgroup__help">Helptext</small>
</div>
<div class="form-group">
<label for="mySelect4449" 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="mySelect4449" aria-describedby="mySelect4449Help " name="mySelect4449"
>
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<small id="mySelect4449Help" 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="myCheckbox8260" name="myCheckbox8260">
<label class="form-check-label" for="myCheckbox8260">Antwort 1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox5728" name="myCheckbox5728">
<label class="form-check-label" for="myCheckbox5728">Antwort 2</label>
</div>
</fieldset>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox4175" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox4175">Ja</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox7238" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox7238">Nein</label>
</div>
</fieldset>
<div class="form-actions"> <div class="form-actions__left">
<a href="#randomtarget7261" 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="myInputField5621" 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="myInputField5621" type="text" name="myInputField5621">
</div>
<div class="form-group">
<label for="myInputField1020" 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="myInputField1020" type="password" name="myInputField1020">
</div>
<div class="form-actions">
<button type="submit" class="button">Anmelden</button>
</div>
</form>