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="myInputField4389" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField4389" type="text" name="myInputField4389">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect1726" class="form-label">
Select
</label>
<select class="form-control" id="mySelect1726" name="mySelect1726">
<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="mySelect2683" class="form-label">
Multiselect
</label>
<select class="form-control" multiple id="mySelect2683" name="mySelect2683">
<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="myTextarea4511" class="form-label ">
Textarea
</label>
<textarea class="form-control" id="myTextarea4511" rows="3" name="myTextarea4511"></textarea>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3867" class="form-label ">
Dateiupload
</label>
<input class="form-control" id="myInputField3867" type="file" name="myInputField3867">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7302" class="form-label ">
Time
</label>
<input class="form-control" id="myInputField7302" type="time" name="myInputField7302">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField6165" class="form-label ">
Number
</label>
<input class="form-control" id="myInputField6165" type="number" name="myInputField6165">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1277" class="form-label ">
Url
</label>
<input class="form-control" id="myInputField1277" type="url" name="myInputField1277">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3079" class="form-label ">
Datepicker native (input[type=date])
</label>
<input class="form-control" id="myInputField3079" type="date" name="myInputField3079">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4906" class="form-label ">
Datepicker with flatpickr.js (input.datepicker)
</label>
<input class="form-control datepicker" id="myInputField4906" type="text" name="myInputField4906">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5245" class="form-label ">
Readonly
</label>
<input class="form-control" readonly id="myInputField5245" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField5245">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField6258" 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="myInputField6258" type="text" name="myInputField6258">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField6184" class="form-label ">
Input as plaintext
</label>
<input class="form-control-plaintext" readonly id="myInputField6184" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField6184">
</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="myCheckbox3998" name="myCheckbox3998">
<label class="form-check-label" for="myCheckbox3998">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox2396" name="myCheckbox2396">
<label class="form-check-label" for="myCheckbox2396">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox3837" name="myCheckbox3837">
<label class="form-check-label" for="myCheckbox3837">Disabled checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox187" name="myCheckbox187">
<label class="form-check-label" for="myCheckbox187">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="myCheckbox2628" name="myCheckbox2628">
<label class="form-check-label" for="myCheckbox2628">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="myCheckbox7953" name="exampleRadios">
<label class="form-check-label" for="myCheckbox7953">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox2315" name="exampleRadios">
<label class="form-check-label" for="myCheckbox2315">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" disabled id="myCheckbox7292" name="exampleRadios">
<label class="form-check-label" for="myCheckbox7292">Disabled radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox4472" name="exampleRadios">
<label class="form-check-label" for="myCheckbox4472">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="myCheckbox8406" name="exampleRadios">
<label class="form-check-label" for="myCheckbox8406">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="myCheckbox1259" name="myCheckbox1259">
<label class="form-check-label" for="myCheckbox1259">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox1912" name="myCheckbox1912">
<label class="form-check-label" for="myCheckbox1912">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox2175" name="myCheckbox2175">
<label class="form-check-label" for="myCheckbox2175">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="myCheckbox2937" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox2937">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox6605" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox6605">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" disabled id="myCheckbox4417" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox4417">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-1220" id="toggle-switch-1220" 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-1220">Receive Notifications</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-9051" id="toggle-switch-9051" 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-9051">Receive SMS</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-106" id="toggle-switch-106" 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-106">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="myInputField782" class="form-label ">
Passwort
</label>
<input class="form-control" id="myInputField782" type="password" aria-describedby="myInputField782Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField782">
<small id="myInputField782Help" 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="myInputField1172" class="form-label ">
Textfeld
</label>
<input class="form-control is-invalid" id="myInputField1172" type="text" aria-describedby="myInputField1172Invalid " name="myInputField1172">
<div class="message message--error" id="myInputField1172Invalid">
Bitte füllen Sie dieses Feld aus.
</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9303" class="form-label ">
Textfeld
</label>
<input class="form-control is-valid" id="myInputField9303" type="text" aria-describedby="myInputField9303Valid " value="Ich bin ein Text" name="myInputField9303">
<div class="message message--success" id="myInputField9303Valid">
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="myCheckbox1741Invalid " id="myCheckbox1741" name="myCheckbox1741">
<label class="form-check-label" for="myCheckbox1741">Checkbox</label>
<div id="myCheckbox1741Invalid" 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="myCheckbox4438Valid " id="myCheckbox4438" name="myCheckbox4438">
<label class="form-check-label" for="myCheckbox4438">Checkbox</label>
<div id="myCheckbox4438Valid" 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="myInputField8073" class="form-label aural">
Textfeld
</label>
<input class="form-control" id="myInputField8073" type="text" name="myInputField8073">
</div>
<div class="form-group">
<label for="mySelect8458" class="form-label aural">
Auswahlliste
</label>
<select class="form-control" id="mySelect8458" name="mySelect8458">
<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="myCheckbox8673" name="myCheckbox8673">
<label class="form-check-label" for="myCheckbox8673">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="myInputField5050" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField5050" type="text" name="myInputField5050">
</div>
<div class="form-group">
<label for="myInputField3619" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField3619" type="text" name="myInputField3619">
</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="myInputField2945" 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="myInputField2945" type="text" aria-describedby="myInputField2945Help " name="myInputField2945">
<small id="myInputField2945Help" class="formgroup__help">Helptext</small>
</div>
<div class="form-group">
<label for="mySelect5884" 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="mySelect5884" aria-describedby="mySelect5884Help " name="mySelect5884">
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<small id="mySelect5884Help" 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="myCheckbox8611" name="myCheckbox8611">
<label class="form-check-label" for="myCheckbox8611">Antwort 1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox4780" name="myCheckbox4780">
<label class="form-check-label" for="myCheckbox4780">Antwort 2</label>
</div>
</fieldset>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox5699" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox5699">Ja</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox6967" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox6967">Nein</label>
</div>
</fieldset>
<div class="form-actions"> <div class="form-actions__left">
<a href="#randomtarget159" 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="myInputField4633" 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="myInputField4633" type="text" name="myInputField4633">
</div>
<div class="form-group">
<label for="myInputField1145" 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="myInputField1145" type="password" name="myInputField1145">
</div>
<div class="form-actions">
<button type="submit" class="button">Anmelden</button>
</div>
</form>