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="myInputField4026" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField4026" type="text" name="myInputField4026">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect2032" class="form-label">
Select
</label>
<select class="form-control" id="mySelect2032" name="mySelect2032"
>
<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="mySelect1936" class="form-label">
Multiselect
</label>
<select class="form-control" multiple id="mySelect1936" name="mySelect1936"
>
<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 js-multi-select">
<label id="mylabel6235" class="form-label">JS Multiselect</label>
<!-- Trigger -->
<button type="button" class="multi-select__trigger" aria-expanded="false" aria-controls="mypanel6235" aria-labelledby="mylabel6235 mytext6235">
<span id="mytext6235" class="multi-select__text">Bitte wählen</span>
</button>
<!-- Text/Messages (i18n) -->
<div class="multi-select__messages" hidden>
<span data-role="placeholder">Bitte wählen</span>
<span data-role="selected">ausgewählt</span>
</div>
<!-- Dropdown Panel -->
<div class="multi-select__panel" id="mypanel6235" hidden>
<fieldset class="multi-select__options">
<legend class="aural">JS Multiselect auswählen</legend>
<label class="multi-select__option">
<input type="checkbox" name="myname6235[]" value="option1">Option 1</label>
<label class="multi-select__option">
<input type="checkbox" name="myname6235[]" value="option2">Option 2</label>
<label class="multi-select__option">
<input type="checkbox" name="myname6235[]" value="option3">Option 3</label>
</fieldset>
</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4248" class="form-label ">
Dateiupload
</label>
<input class="form-control" id="myInputField4248" type="file" name="myInputField4248">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9848" class="form-label ">
Time
</label>
<input class="form-control" id="myInputField9848" type="time" name="myInputField9848">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9950" class="form-label ">
Number
</label>
<input class="form-control" id="myInputField9950" type="number" name="myInputField9950">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9114" class="form-label ">
Url
</label>
<input class="form-control" id="myInputField9114" type="url" name="myInputField9114">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9898" class="form-label ">
Datepicker native (input[type=date])
</label>
<input class="form-control" id="myInputField9898" type="date" name="myInputField9898">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7353" class="form-label ">
Datepicker with flatpickr.js (input.datepicker)
</label>
<input class="form-control datepicker" id="myInputField7353" type="text" name="myInputField7353">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1453" class="form-label ">
Readonly
</label>
<input class="form-control" readonly id="myInputField1453" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField1453">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField6315" 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="myInputField6315" type="text" name="myInputField6315">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField8229" class="form-label ">
Input as plaintext
</label>
<input class="form-control-plaintext" readonly id="myInputField8229" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField8229">
</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="myCheckbox5884" name="myCheckbox5884">
<label class="form-check-label" for="myCheckbox5884">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox6670" name="myCheckbox6670">
<label class="form-check-label" for="myCheckbox6670">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox9462" name="myCheckbox9462">
<label class="form-check-label" for="myCheckbox9462">Disabled checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox1116" name="myCheckbox1116">
<label class="form-check-label" for="myCheckbox1116">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="myCheckbox7302" name="myCheckbox7302">
<label class="form-check-label" for="myCheckbox7302">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="myCheckbox8353" name="exampleRadios">
<label class="form-check-label" for="myCheckbox8353">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox10000" name="exampleRadios">
<label class="form-check-label" for="myCheckbox10000">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" disabled id="myCheckbox608" name="exampleRadios">
<label class="form-check-label" for="myCheckbox608">Disabled radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox2161" name="exampleRadios">
<label class="form-check-label" for="myCheckbox2161">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="myCheckbox5196" name="exampleRadios">
<label class="form-check-label" for="myCheckbox5196">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="myCheckbox4654" name="myCheckbox4654">
<label class="form-check-label" for="myCheckbox4654">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox1865" name="myCheckbox1865">
<label class="form-check-label" for="myCheckbox1865">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox2384" name="myCheckbox2384">
<label class="form-check-label" for="myCheckbox2384">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="myCheckbox2422" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox2422">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox99" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox99">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" disabled id="myCheckbox7973" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox7973">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-7020" id="toggle-switch-7020" 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-7020">Receive Notifications</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-5468" id="toggle-switch-5468" 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-5468">Receive SMS</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-9362" id="toggle-switch-9362" 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-9362">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="myInputField8579" class="form-label ">
Passwort
</label>
<input class="form-control" id="myInputField8579" type="password" aria-describedby="myInputField8579Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField8579">
<small id="myInputField8579Help" 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="myInputField4750" class="form-label ">
Textfeld
</label>
<input class="form-control is-invalid" id="myInputField4750" type="text" aria-invalid="true" aria-describedby="myInputField4750Invalid " name="myInputField4750">
<p id="myInputField4750Invalid" class="message message--error">Bitte füllen Sie dieses Feld aus.</p>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-check">
<input class="form-check-input is-invalid" type="checkbox" aria-invalid="true" aria-describedby="myCheckbox8331Invalid " id="myCheckbox8331" name="myCheckbox8331">
<label class="form-check-label" for="myCheckbox8331">Checkbox</label>
<p id="myCheckbox8331Invalid" class="message message--error">Bitte füllen Sie dieses Feld aus.</p>
</div>
</form>
<form class="form--base panel--heavy">
<fieldset >
<legend >
Wie zufrieden sind Sie mit dieser Frage?
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input is-invalid" type="radio" aria-invalid="true" aria-describedby="myFieldset7234Invalid" id="myCheckbox6357" name="exampleRadios">
<label class="form-check-label" for="myCheckbox6357">Sehr zufrieden</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input is-invalid" type="radio" aria-invalid="true" aria-describedby="myFieldset7234Invalid" id="myCheckbox1345" name="exampleRadios">
<label class="form-check-label" for="myCheckbox1345">Ist mir egal</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input is-invalid" type="radio" aria-invalid="true" aria-describedby="myFieldset7234Invalid" id="myCheckbox308" name="exampleRadios">
<label class="form-check-label" for="myCheckbox308">Weniger zufrieden</label>
</div>
<p class="message message--error" id="myFieldset7234Invalid">Bitte füllen Sie dieses Feld aus.</p>
</fieldset>
</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="myInputField6267" class="form-label aural">
Textfeld
</label>
<input class="form-control" id="myInputField6267" type="text" name="myInputField6267">
</div>
<div class="form-group">
<label for="mySelect7410" class="form-label aural">
Auswahlliste
</label>
<select class="form-control" id="mySelect7410" name="mySelect7410"
>
<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="myCheckbox8973" name="myCheckbox8973">
<label class="form-check-label" for="myCheckbox8973">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="myInputField9436" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField9436" type="text" name="myInputField9436">
</div>
<div class="form-group">
<label for="myInputField6737" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField6737" type="text" name="myInputField6737">
</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="myInputField1586" 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="myInputField1586" type="text" aria-describedby="myInputField1586Help " name="myInputField1586">
<small id="myInputField1586Help" class="formgroup__help">Helptext</small>
</div>
<div class="form-group">
<label for="mySelect7286" 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="mySelect7286" aria-describedby="mySelect7286Help " name="mySelect7286"
>
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<small id="mySelect7286Help" 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="myCheckbox6012" name="myCheckbox6012">
<label class="form-check-label" for="myCheckbox6012">Antwort 1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox2524" name="myCheckbox2524">
<label class="form-check-label" for="myCheckbox2524">Antwort 2</label>
</div>
</fieldset>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox4572" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox4572">Ja</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox7465" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox7465">Nein</label>
</div>
</fieldset>
<div class="form-actions"> <div class="form-actions__left">
<a href="#randomtarget7211" 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="myInputField8026" 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="myInputField8026" type="text" name="myInputField8026">
</div>
<div class="form-group">
<label for="myInputField185" 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="myInputField185" type="password" name="myInputField185">
</div>
<div class="form-actions">
<button type="submit" class="button">Anmelden</button>
</div>
</form>