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="myInputField1496" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField1496" type="text" name="myInputField1496">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect1964" class="form-label">
Select
</label>
<select class="form-control" id="mySelect1964" name="mySelect1964"
>
<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="mySelect2013" class="form-label">
Multiselect
</label>
<select class="form-control" multiple id="mySelect2013" name="mySelect2013"
>
<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="mylabel2261" class="form-label">JS Multiselect</label>
<!-- Trigger -->
<button type="button" class="multi-select__trigger" aria-expanded="false" aria-controls="mypanel2261" aria-labelledby="mylabel2261 mytext2261">
<span id="mytext2261" 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="mypanel2261" hidden>
<fieldset class="multi-select__options">
<legend class="aural">JS Multiselect auswählen</legend>
<label class="multi-select__option">
<input type="checkbox" name="myname2261[]" value="option1">Option 1</label>
<label class="multi-select__option">
<input type="checkbox" name="myname2261[]" value="option2">Option 2</label>
<label class="multi-select__option">
<input type="checkbox" name="myname2261[]" value="option3">Option 3</label>
</fieldset>
</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1481" class="form-label ">
Dateiupload
</label>
<input class="form-control" id="myInputField1481" type="file" name="myInputField1481">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9628" class="form-label ">
Time
</label>
<input class="form-control" id="myInputField9628" type="time" name="myInputField9628">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1601" class="form-label ">
Number
</label>
<input class="form-control" id="myInputField1601" type="number" name="myInputField1601">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9107" class="form-label ">
Url
</label>
<input class="form-control" id="myInputField9107" type="url" name="myInputField9107">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7460" class="form-label ">
Datepicker native (input[type=date])
</label>
<input class="form-control" id="myInputField7460" type="date" name="myInputField7460">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9928" class="form-label ">
Datepicker with flatpickr.js (input.datepicker)
</label>
<input class="form-control datepicker" id="myInputField9928" type="text" name="myInputField9928">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField6357" class="form-label ">
Readonly
</label>
<input class="form-control" readonly id="myInputField6357" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField6357">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField2132" 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="myInputField2132" type="text" name="myInputField2132">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField4518" class="form-label ">
Input as plaintext
</label>
<input class="form-control-plaintext" readonly id="myInputField4518" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField4518">
</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="myCheckbox6945" name="myCheckbox6945">
<label class="form-check-label" for="myCheckbox6945">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox6954" name="myCheckbox6954">
<label class="form-check-label" for="myCheckbox6954">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox1321" name="myCheckbox1321">
<label class="form-check-label" for="myCheckbox1321">Disabled checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox6150" name="myCheckbox6150">
<label class="form-check-label" for="myCheckbox6150">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="myCheckbox4906" name="myCheckbox4906">
<label class="form-check-label" for="myCheckbox4906">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="myCheckbox9429" name="exampleRadios">
<label class="form-check-label" for="myCheckbox9429">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox1978" name="exampleRadios">
<label class="form-check-label" for="myCheckbox1978">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" disabled id="myCheckbox461" name="exampleRadios">
<label class="form-check-label" for="myCheckbox461">Disabled radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox4473" name="exampleRadios">
<label class="form-check-label" for="myCheckbox4473">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="myCheckbox4883" name="exampleRadios">
<label class="form-check-label" for="myCheckbox4883">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="myCheckbox9624" name="myCheckbox9624">
<label class="form-check-label" for="myCheckbox9624">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox9580" name="myCheckbox9580">
<label class="form-check-label" for="myCheckbox9580">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox4325" name="myCheckbox4325">
<label class="form-check-label" for="myCheckbox4325">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="myCheckbox8268" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox8268">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox1895" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox1895">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" disabled id="myCheckbox551" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox551">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-8459" id="toggle-switch-8459" 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-8459">Receive Notifications</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-9391" id="toggle-switch-9391" 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-9391">Receive SMS</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-8906" id="toggle-switch-8906" 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-8906">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="myInputField4616" class="form-label ">
Passwort
</label>
<input class="form-control" id="myInputField4616" type="password" aria-describedby="myInputField4616Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField4616">
<small id="myInputField4616Help" 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="myInputField6644" class="form-label ">
Textfeld
</label>
<input class="form-control is-invalid" id="myInputField6644" type="text" aria-invalid="true" aria-describedby="myInputField6644Invalid " name="myInputField6644">
<p id="myInputField6644Invalid" 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="myCheckbox4264Invalid " id="myCheckbox4264" name="myCheckbox4264">
<label class="form-check-label" for="myCheckbox4264">Checkbox</label>
<p id="myCheckbox4264Invalid" 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="myFieldset5457Invalid" id="myCheckbox4058" name="exampleRadios">
<label class="form-check-label" for="myCheckbox4058">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="myFieldset5457Invalid" id="myCheckbox1495" name="exampleRadios">
<label class="form-check-label" for="myCheckbox1495">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="myFieldset5457Invalid" id="myCheckbox2925" name="exampleRadios">
<label class="form-check-label" for="myCheckbox2925">Weniger zufrieden</label>
</div>
<p class="message message--error" id="myFieldset5457Invalid">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="myInputField8329" class="form-label aural">
Textfeld
</label>
<input class="form-control" id="myInputField8329" type="text" name="myInputField8329">
</div>
<div class="form-group">
<label for="mySelect6433" class="form-label aural">
Auswahlliste
</label>
<select class="form-control" id="mySelect6433" name="mySelect6433"
>
<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="myCheckbox9412" name="myCheckbox9412">
<label class="form-check-label" for="myCheckbox9412">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="myInputField1805" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField1805" type="text" name="myInputField1805">
</div>
<div class="form-group">
<label for="myInputField7875" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField7875" type="text" name="myInputField7875">
</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="myInputField4278" 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="myInputField4278" type="text" aria-describedby="myInputField4278Help " name="myInputField4278">
<small id="myInputField4278Help" class="formgroup__help">Helptext</small>
</div>
<div class="form-group">
<label for="mySelect8645" 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="mySelect8645" aria-describedby="mySelect8645Help " name="mySelect8645"
>
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<small id="mySelect8645Help" 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="myCheckbox3494" name="myCheckbox3494">
<label class="form-check-label" for="myCheckbox3494">Antwort 1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox4081" name="myCheckbox4081">
<label class="form-check-label" for="myCheckbox4081">Antwort 2</label>
</div>
</fieldset>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox8921" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox8921">Ja</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox3108" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox3108">Nein</label>
</div>
</fieldset>
<div class="form-actions"> <div class="form-actions__left">
<a href="#randomtarget5359" 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="myInputField4887" 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="myInputField4887" type="text" name="myInputField4887">
</div>
<div class="form-group">
<label for="myInputField1839" 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="myInputField1839" type="password" name="myInputField1839">
</div>
<div class="form-actions">
<button type="submit" class="button">Anmelden</button>
</div>
</form>