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="myInputField8913" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField8913" type="text" name="myInputField8913">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect1667" class="form-label">
Select
</label>
<select class="form-control" id="mySelect1667" name="mySelect1667">
<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="mySelect1403" class="form-label">
Multiselect
</label>
<select class="form-control" multiple id="mySelect1403" name="mySelect1403">
<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="myTextarea3298" class="form-label ">
Textarea
</label>
<textarea class="form-control" id="myTextarea3298" rows="3" name="myTextarea3298"></textarea>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9527" class="form-label ">
Dateiupload
</label>
<input class="form-control" id="myInputField9527" type="file" name="myInputField9527">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7811" class="form-label ">
Time
</label>
<input class="form-control" id="myInputField7811" type="time" name="myInputField7811">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5182" class="form-label ">
Number
</label>
<input class="form-control" id="myInputField5182" type="number" name="myInputField5182">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4410" class="form-label ">
Url
</label>
<input class="form-control" id="myInputField4410" type="url" name="myInputField4410">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField2001" class="form-label ">
Datepicker native (input[type=date])
</label>
<input class="form-control" id="myInputField2001" type="date" name="myInputField2001">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4521" class="form-label ">
Datepicker with flatpickr.js (input.datepicker)
</label>
<input class="form-control datepicker" id="myInputField4521" type="text" name="myInputField4521">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4060" class="form-label ">
Readonly
</label>
<input class="form-control" readonly id="myInputField4060" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField4060">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5838" 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="myInputField5838" type="text" name="myInputField5838">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1404" class="form-label ">
Input as plaintext
</label>
<input class="form-control-plaintext" readonly id="myInputField1404" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField1404">
</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="myCheckbox3145" name="myCheckbox3145">
<label class="form-check-label" for="myCheckbox3145">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox8620" name="myCheckbox8620">
<label class="form-check-label" for="myCheckbox8620">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox9520" name="myCheckbox9520">
<label class="form-check-label" for="myCheckbox9520">Disabled checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox4921" name="myCheckbox4921">
<label class="form-check-label" for="myCheckbox4921">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="myCheckbox9626" name="myCheckbox9626">
<label class="form-check-label" for="myCheckbox9626">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="myCheckbox3734" name="exampleRadios">
<label class="form-check-label" for="myCheckbox3734">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox5824" name="exampleRadios">
<label class="form-check-label" for="myCheckbox5824">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" disabled id="myCheckbox4886" name="exampleRadios">
<label class="form-check-label" for="myCheckbox4886">Disabled radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox6122" name="exampleRadios">
<label class="form-check-label" for="myCheckbox6122">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="myCheckbox3322" name="exampleRadios">
<label class="form-check-label" for="myCheckbox3322">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="myCheckbox4145" name="myCheckbox4145">
<label class="form-check-label" for="myCheckbox4145">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox3117" name="myCheckbox3117">
<label class="form-check-label" for="myCheckbox3117">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox4523" name="myCheckbox4523">
<label class="form-check-label" for="myCheckbox4523">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="myCheckbox9543" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox9543">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox9190" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox9190">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" disabled id="myCheckbox158" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox158">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-1973" id="toggle-switch-1973" 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-1973">Receive Notifications</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-5363" id="toggle-switch-5363" 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-5363">Receive SMS</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-7608" id="toggle-switch-7608" 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-7608">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="myInputField7445" class="form-label ">
Passwort
</label>
<input class="form-control" id="myInputField7445" type="password" aria-describedby="myInputField7445Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField7445">
<small id="myInputField7445Help" 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="myInputField498" class="form-label ">
Textfeld
</label>
<input class="form-control is-invalid" id="myInputField498" type="text" aria-describedby="myInputField498Invalid " name="myInputField498">
<div class="message message--error" id="myInputField498Invalid">
Bitte füllen Sie dieses Feld aus.
</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5061" class="form-label ">
Textfeld
</label>
<input class="form-control is-valid" id="myInputField5061" type="text" aria-describedby="myInputField5061Valid " value="Ich bin ein Text" name="myInputField5061">
<div class="message message--success" id="myInputField5061Valid">
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="myCheckbox1335Invalid " id="myCheckbox1335" name="myCheckbox1335">
<label class="form-check-label" for="myCheckbox1335">Checkbox</label>
<div id="myCheckbox1335Invalid" 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="myCheckbox2999Valid " id="myCheckbox2999" name="myCheckbox2999">
<label class="form-check-label" for="myCheckbox2999">Checkbox</label>
<div id="myCheckbox2999Valid" 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="myInputField1906" class="form-label aural">
Textfeld
</label>
<input class="form-control" id="myInputField1906" type="text" name="myInputField1906">
</div>
<div class="form-group">
<label for="mySelect4106" class="form-label aural">
Auswahlliste
</label>
<select class="form-control" id="mySelect4106" name="mySelect4106">
<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="myCheckbox3932" name="myCheckbox3932">
<label class="form-check-label" for="myCheckbox3932">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="myInputField4995" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField4995" type="text" name="myInputField4995">
</div>
<div class="form-group">
<label for="myInputField8308" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField8308" type="text" name="myInputField8308">
</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="myInputField8407" 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="myInputField8407" type="text" aria-describedby="myInputField8407Help " name="myInputField8407">
<small id="myInputField8407Help" class="formgroup__help">Helptext</small>
</div>
<div class="form-group">
<label for="mySelect9705" 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="mySelect9705" aria-describedby="mySelect9705Help " name="mySelect9705">
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<small id="mySelect9705Help" 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="myCheckbox4089" name="myCheckbox4089">
<label class="form-check-label" for="myCheckbox4089">Antwort 1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox1419" name="myCheckbox1419">
<label class="form-check-label" for="myCheckbox1419">Antwort 2</label>
</div>
</fieldset>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox3524" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox3524">Ja</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox6333" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox6333">Nein</label>
</div>
</fieldset>
<div class="form-actions"> <div class="form-actions__left">
<a href="#randomtarget7434" 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="myInputField776" 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="myInputField776" type="text" name="myInputField776">
</div>
<div class="form-group">
<label for="myInputField7830" 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="myInputField7830" type="password" name="myInputField7830">
</div>
<div class="form-actions">
<button type="submit" class="button">Anmelden</button>
</div>
</form>