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="myInputField8566" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField8566" type="text" name="myInputField8566">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect9460" class="form-label">
Select
</label>
<select class="form-control" id="mySelect9460" name="mySelect9460">
<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="mySelect2276" class="form-label">
Multiselect
</label>
<select class="form-control" multiple id="mySelect2276" name="mySelect2276">
<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="myTextarea8700" class="form-label ">
Textarea
</label>
<textarea class="form-control" id="myTextarea8700" rows="3" name="myTextarea8700"></textarea>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField280" class="form-label ">
Dateiupload
</label>
<input class="form-control" id="myInputField280" type="file" name="myInputField280">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5543" class="form-label ">
Time
</label>
<input class="form-control" id="myInputField5543" type="time" name="myInputField5543">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField8349" class="form-label ">
Number
</label>
<input class="form-control" id="myInputField8349" type="number" name="myInputField8349">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3608" class="form-label ">
Url
</label>
<input class="form-control" id="myInputField3608" type="url" name="myInputField3608">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField2008" class="form-label ">
Datepicker native (input[type=date])
</label>
<input class="form-control" id="myInputField2008" type="date" name="myInputField2008">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5067" class="form-label ">
Datepicker with flatpickr.js (input.datepicker)
</label>
<input class="form-control datepicker" id="myInputField5067" type="text" name="myInputField5067">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField987" class="form-label ">
Readonly
</label>
<input class="form-control" readonly id="myInputField987" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField987">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField6660" 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="myInputField6660" type="text" name="myInputField6660">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField603" class="form-label ">
Input as plaintext
</label>
<input class="form-control-plaintext" readonly id="myInputField603" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField603">
</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="myCheckbox5014" name="myCheckbox5014">
<label class="form-check-label" for="myCheckbox5014">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox6720" name="myCheckbox6720">
<label class="form-check-label" for="myCheckbox6720">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox1838" name="myCheckbox1838">
<label class="form-check-label" for="myCheckbox1838">Disabled checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox87" name="myCheckbox87">
<label class="form-check-label" for="myCheckbox87">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="myCheckbox4156" name="myCheckbox4156">
<label class="form-check-label" for="myCheckbox4156">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="myCheckbox4628" name="exampleRadios">
<label class="form-check-label" for="myCheckbox4628">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox1489" name="exampleRadios">
<label class="form-check-label" for="myCheckbox1489">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" disabled id="myCheckbox9336" name="exampleRadios">
<label class="form-check-label" for="myCheckbox9336">Disabled radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox4891" name="exampleRadios">
<label class="form-check-label" for="myCheckbox4891">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="myCheckbox1082" name="exampleRadios">
<label class="form-check-label" for="myCheckbox1082">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="myCheckbox8159" name="myCheckbox8159">
<label class="form-check-label" for="myCheckbox8159">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox942" name="myCheckbox942">
<label class="form-check-label" for="myCheckbox942">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox2094" name="myCheckbox2094">
<label class="form-check-label" for="myCheckbox2094">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="myCheckbox8210" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox8210">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox8180" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox8180">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" disabled id="myCheckbox7046" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox7046">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-5603" id="toggle-switch-5603" 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-5603">Receive Notifications</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-3765" id="toggle-switch-3765" 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-3765">Receive SMS</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-132" id="toggle-switch-132" 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-132">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="myInputField4672" class="form-label ">
Passwort
</label>
<input class="form-control" id="myInputField4672" type="password" aria-describedby="myInputField4672Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField4672">
<small id="myInputField4672Help" 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="myInputField8985" class="form-label ">
Textfeld
</label>
<input class="form-control is-invalid" id="myInputField8985" type="text" aria-describedby="myInputField8985Invalid " name="myInputField8985">
<div class="message message--error" id="myInputField8985Invalid">
Bitte füllen Sie dieses Feld aus.
</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3234" class="form-label ">
Textfeld
</label>
<input class="form-control is-valid" id="myInputField3234" type="text" aria-describedby="myInputField3234Valid " value="Ich bin ein Text" name="myInputField3234">
<div class="message message--success" id="myInputField3234Valid">
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="myCheckbox4857Invalid " id="myCheckbox4857" name="myCheckbox4857">
<label class="form-check-label" for="myCheckbox4857">Checkbox</label>
<div id="myCheckbox4857Invalid" 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="myCheckbox4201Valid " id="myCheckbox4201" name="myCheckbox4201">
<label class="form-check-label" for="myCheckbox4201">Checkbox</label>
<div id="myCheckbox4201Valid" 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="myInputField4975" class="form-label aural">
Textfeld
</label>
<input class="form-control" id="myInputField4975" type="text" name="myInputField4975">
</div>
<div class="form-group">
<label for="mySelect2244" class="form-label aural">
Auswahlliste
</label>
<select class="form-control" id="mySelect2244" name="mySelect2244">
<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="myCheckbox1785" name="myCheckbox1785">
<label class="form-check-label" for="myCheckbox1785">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="myInputField1501" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField1501" type="text" name="myInputField1501">
</div>
<div class="form-group">
<label for="myInputField698" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField698" type="text" name="myInputField698">
</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="myInputField35" 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="myInputField35" type="text" aria-describedby="myInputField35Help " name="myInputField35">
<small id="myInputField35Help" class="formgroup__help">Helptext</small>
</div>
<div class="form-group">
<label for="mySelect4007" 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="mySelect4007" aria-describedby="mySelect4007Help " name="mySelect4007">
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<small id="mySelect4007Help" 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="myCheckbox648" name="myCheckbox648">
<label class="form-check-label" for="myCheckbox648">Antwort 1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox8263" name="myCheckbox8263">
<label class="form-check-label" for="myCheckbox8263">Antwort 2</label>
</div>
</fieldset>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox5825" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox5825">Ja</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox1456" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox1456">Nein</label>
</div>
</fieldset>
<div class="form-actions"> <div class="form-actions__left">
<a href="#randomtarget9171" 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="myInputField5424" 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="myInputField5424" type="text" name="myInputField5424">
</div>
<div class="form-group">
<label for="myInputField7568" 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="myInputField7568" type="password" name="myInputField7568">
</div>
<div class="form-actions">
<button type="submit" class="button">Anmelden</button>
</div>
</form>