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="myInputField7828" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField7828" type="text" name="myInputField7828">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect8169" class="form-label">
Select
</label>
<select class="form-control" id="mySelect8169" name="mySelect8169">
<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="mySelect2012" class="form-label">
Multiselect
</label>
<select class="form-control" multiple id="mySelect2012" name="mySelect2012">
<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="myTextarea5168" class="form-label ">
Textarea
</label>
<textarea class="form-control" id="myTextarea5168" rows="3" name="myTextarea5168"></textarea>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField312" class="form-label ">
Dateiupload
</label>
<input class="form-control" id="myInputField312" type="file" name="myInputField312">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3702" class="form-label ">
Time
</label>
<input class="form-control" id="myInputField3702" type="time" name="myInputField3702">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3572" class="form-label ">
Number
</label>
<input class="form-control" id="myInputField3572" type="number" name="myInputField3572">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5681" class="form-label ">
Url
</label>
<input class="form-control" id="myInputField5681" type="url" name="myInputField5681">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField8354" class="form-label ">
Datepicker native (input[type=date])
</label>
<input class="form-control" id="myInputField8354" type="date" name="myInputField8354">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField6115" class="form-label ">
Datepicker with flatpickr.js (input.datepicker)
</label>
<input class="form-control datepicker" id="myInputField6115" type="text" name="myInputField6115">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField8906" class="form-label ">
Readonly
</label>
<input class="form-control" readonly id="myInputField8906" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField8906">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField8744" 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="myInputField8744" type="text" name="myInputField8744">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4311" class="form-label ">
Input as plaintext
</label>
<input class="form-control-plaintext" readonly id="myInputField4311" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField4311">
</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="myCheckbox8634" name="myCheckbox8634">
<label class="form-check-label" for="myCheckbox8634">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox3009" name="myCheckbox3009">
<label class="form-check-label" for="myCheckbox3009">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox6802" name="myCheckbox6802">
<label class="form-check-label" for="myCheckbox6802">Disabled checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox3705" name="myCheckbox3705">
<label class="form-check-label" for="myCheckbox3705">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="myCheckbox1055" name="myCheckbox1055">
<label class="form-check-label" for="myCheckbox1055">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="myCheckbox5851" name="exampleRadios">
<label class="form-check-label" for="myCheckbox5851">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox5654" name="exampleRadios">
<label class="form-check-label" for="myCheckbox5654">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" disabled id="myCheckbox396" name="exampleRadios">
<label class="form-check-label" for="myCheckbox396">Disabled radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox2886" name="exampleRadios">
<label class="form-check-label" for="myCheckbox2886">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="myCheckbox9982" name="exampleRadios">
<label class="form-check-label" for="myCheckbox9982">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="myCheckbox7129" name="myCheckbox7129">
<label class="form-check-label" for="myCheckbox7129">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox8791" name="myCheckbox8791">
<label class="form-check-label" for="myCheckbox8791">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox803" name="myCheckbox803">
<label class="form-check-label" for="myCheckbox803">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="myCheckbox1713" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox1713">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox1507" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox1507">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" disabled id="myCheckbox9678" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox9678">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-6824" id="toggle-switch-6824" 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-6824">Receive Notifications</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-5758" id="toggle-switch-5758" 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-5758">Receive SMS</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-5634" id="toggle-switch-5634" 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-5634">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="myInputField7209" class="form-label ">
Passwort
</label>
<input class="form-control" id="myInputField7209" type="password" aria-describedby="myInputField7209Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField7209">
<small id="myInputField7209Help" 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="myInputField1954" class="form-label ">
Textfeld
</label>
<input class="form-control is-invalid" id="myInputField1954" type="text" aria-describedby="myInputField1954Invalid " name="myInputField1954">
<div class="message message--error" id="myInputField1954Invalid">
Bitte füllen Sie dieses Feld aus.
</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1725" class="form-label ">
Textfeld
</label>
<input class="form-control is-valid" id="myInputField1725" type="text" aria-describedby="myInputField1725Valid " value="Ich bin ein Text" name="myInputField1725">
<div class="message message--success" id="myInputField1725Valid">
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="myCheckbox3223Invalid " id="myCheckbox3223" name="myCheckbox3223">
<label class="form-check-label" for="myCheckbox3223">Checkbox</label>
<div id="myCheckbox3223Invalid" 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="myCheckbox668Valid " id="myCheckbox668" name="myCheckbox668">
<label class="form-check-label" for="myCheckbox668">Checkbox</label>
<div id="myCheckbox668Valid" 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="myInputField9841" class="form-label aural">
Textfeld
</label>
<input class="form-control" id="myInputField9841" type="text" name="myInputField9841">
</div>
<div class="form-group">
<label for="mySelect5807" class="form-label aural">
Auswahlliste
</label>
<select class="form-control" id="mySelect5807" name="mySelect5807">
<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="myCheckbox7280" name="myCheckbox7280">
<label class="form-check-label" for="myCheckbox7280">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="myInputField2689" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField2689" type="text" name="myInputField2689">
</div>
<div class="form-group">
<label for="myInputField8563" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField8563" type="text" name="myInputField8563">
</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="myInputField693" 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="myInputField693" type="text" aria-describedby="myInputField693Help " name="myInputField693">
<small id="myInputField693Help" class="formgroup__help">Helptext</small>
</div>
<div class="form-group">
<label for="mySelect4857" 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="mySelect4857" aria-describedby="mySelect4857Help " name="mySelect4857">
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<small id="mySelect4857Help" 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="myCheckbox113" name="myCheckbox113">
<label class="form-check-label" for="myCheckbox113">Antwort 1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox8590" name="myCheckbox8590">
<label class="form-check-label" for="myCheckbox8590">Antwort 2</label>
</div>
</fieldset>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox62" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox62">Ja</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox9550" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox9550">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="myInputField7941" 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="myInputField7941" type="text" name="myInputField7941">
</div>
<div class="form-group">
<label for="myInputField1529" 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="myInputField1529" type="password" name="myInputField1529">
</div>
<div class="form-actions">
<button type="submit" class="button">Anmelden</button>
</div>
</form>