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="myInputField9275" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField9275" type="text" name="myInputField9275">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect833" class="form-label">
Select
</label>
<select class="form-control" id="mySelect833" name="mySelect833">
<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="mySelect8265" class="form-label">
Multiselect
</label>
<select class="form-control" multiple id="mySelect8265" name="mySelect8265">
<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="myTextarea982" class="form-label ">
Textarea
</label>
<textarea class="form-control" id="myTextarea982" rows="3" name="myTextarea982"></textarea>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField8350" class="form-label ">
Dateiupload
</label>
<input class="form-control" id="myInputField8350" type="file" name="myInputField8350">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField2750" class="form-label ">
Time
</label>
<input class="form-control" id="myInputField2750" type="time" name="myInputField2750">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1647" class="form-label ">
Number
</label>
<input class="form-control" id="myInputField1647" type="number" name="myInputField1647">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4084" class="form-label ">
Url
</label>
<input class="form-control" id="myInputField4084" type="url" name="myInputField4084">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9671" class="form-label ">
Datepicker native (input[type=date])
</label>
<input class="form-control" id="myInputField9671" type="date" name="myInputField9671">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1981" class="form-label ">
Datepicker with flatpickr.js (input.datepicker)
</label>
<input class="form-control datepicker" id="myInputField1981" type="text" name="myInputField1981">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3140" class="form-label ">
Readonly
</label>
<input class="form-control" readonly id="myInputField3140" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField3140">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7555" 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="myInputField7555" type="text" name="myInputField7555">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7690" class="form-label ">
Input as plaintext
</label>
<input class="form-control-plaintext" readonly id="myInputField7690" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField7690">
</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="myCheckbox5778" name="myCheckbox5778">
<label class="form-check-label" for="myCheckbox5778">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox3205" name="myCheckbox3205">
<label class="form-check-label" for="myCheckbox3205">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox8259" name="myCheckbox8259">
<label class="form-check-label" for="myCheckbox8259">Disabled checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox8106" name="myCheckbox8106">
<label class="form-check-label" for="myCheckbox8106">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="myCheckbox5264" name="myCheckbox5264">
<label class="form-check-label" for="myCheckbox5264">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="myCheckbox4386" name="exampleRadios">
<label class="form-check-label" for="myCheckbox4386">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox2782" name="exampleRadios">
<label class="form-check-label" for="myCheckbox2782">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" disabled id="myCheckbox4008" name="exampleRadios">
<label class="form-check-label" for="myCheckbox4008">Disabled radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox197" name="exampleRadios">
<label class="form-check-label" for="myCheckbox197">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="myCheckbox1537" name="exampleRadios">
<label class="form-check-label" for="myCheckbox1537">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="myCheckbox4621" name="myCheckbox4621">
<label class="form-check-label" for="myCheckbox4621">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox6727" name="myCheckbox6727">
<label class="form-check-label" for="myCheckbox6727">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox701" name="myCheckbox701">
<label class="form-check-label" for="myCheckbox701">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="myCheckbox8751" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox8751">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox5427" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox5427">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" disabled id="myCheckbox8478" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox8478">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-6767" id="toggle-switch-6767" 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-6767">Receive Notifications</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-8617" id="toggle-switch-8617" 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-8617">Receive SMS</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-2823" id="toggle-switch-2823" 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-2823">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="myInputField2530" class="form-label ">
Passwort
</label>
<input class="form-control" id="myInputField2530" type="password" aria-describedby="myInputField2530Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField2530">
<small id="myInputField2530Help" 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="myInputField1048" class="form-label ">
Textfeld
</label>
<input class="form-control is-invalid" id="myInputField1048" type="text" aria-describedby="myInputField1048Invalid " name="myInputField1048">
<div class="message message--error" id="myInputField1048Invalid">
Bitte füllen Sie dieses Feld aus.
</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4582" class="form-label ">
Textfeld
</label>
<input class="form-control is-valid" id="myInputField4582" type="text" aria-describedby="myInputField4582Valid " value="Ich bin ein Text" name="myInputField4582">
<div class="message message--success" id="myInputField4582Valid">
Dieses Feld ist richtig ausgefüllt.
</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-check">
<input class="form-check-input is-invalid" type="checkbox" aria-describedby="myCheckbox9780Invalid " id="myCheckbox9780" name="myCheckbox9780">
<label class="form-check-label" for="myCheckbox9780">Checkbox</label>
<div id="myCheckbox9780Invalid" class="message message--error">Bitte füllen Sie dieses Feld aus.</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-check">
<input class="form-check-input is-valid" type="checkbox" aria-describedby="myCheckbox2524Valid " id="myCheckbox2524" name="myCheckbox2524">
<label class="form-check-label" for="myCheckbox2524">Checkbox</label>
<div id="myCheckbox2524Valid" class="message message--success">Dieses Feld ist richtig ausgefüllt.</div>
</div>
</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="myInputField7068" class="form-label aural">
Textfeld
</label>
<input class="form-control" id="myInputField7068" type="text" name="myInputField7068">
</div>
<div class="form-group">
<label for="mySelect2478" class="form-label aural">
Auswahlliste
</label>
<select class="form-control" id="mySelect2478" name="mySelect2478">
<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="myCheckbox1768" name="myCheckbox1768">
<label class="form-check-label" for="myCheckbox1768">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="myInputField8319" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField8319" type="text" name="myInputField8319">
</div>
<div class="form-group">
<label for="myInputField3907" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField3907" type="text" name="myInputField3907">
</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="myInputField5735" 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="myInputField5735" type="text" aria-describedby="myInputField5735Help " name="myInputField5735">
<small id="myInputField5735Help" class="formgroup__help">Helptext</small>
</div>
<div class="form-group">
<label for="mySelect9343" 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="mySelect9343" aria-describedby="mySelect9343Help " name="mySelect9343">
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<small id="mySelect9343Help" 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="myCheckbox967" name="myCheckbox967">
<label class="form-check-label" for="myCheckbox967">Antwort 1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox9750" name="myCheckbox9750">
<label class="form-check-label" for="myCheckbox9750">Antwort 2</label>
</div>
</fieldset>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox8274" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox8274">Ja</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox9572" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox9572">Nein</label>
</div>
</fieldset>
<div class="form-actions"> <div class="form-actions__left">
<a href="#randomtarget3382" 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="myInputField5112" 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="myInputField5112" type="text" name="myInputField5112">
</div>
<div class="form-group">
<label for="myInputField5343" 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="myInputField5343" type="password" name="myInputField5343">
</div>
<div class="form-actions">
<button type="submit" class="button">Anmelden</button>
</div>
</form>