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="myInputField4431" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField4431" type="text" name="myInputField4431">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect7633" class="form-label">
Select
</label>
<select class="form-control" id="mySelect7633" name="mySelect7633"
>
<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="mySelect1963" class="form-label">
Multiselect
</label>
<select class="form-control" multiple id="mySelect1963" name="mySelect1963"
>
<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="mylabel1677" class="form-label">JS Multiselect</label>
<!-- Trigger -->
<button type="button" class="multi-select__trigger" aria-expanded="false" aria-controls="mypanel1677" aria-labelledby="mylabel1677 mytext1677">
<span id="mytext1677" 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="mypanel1677" hidden>
<fieldset class="multi-select__options">
<legend class="aural">JS Multiselect auswählen</legend>
<label class="multi-select__option">
<input type="checkbox" name="myname1677[]" value="option1">Option 1</label>
<label class="multi-select__option">
<input type="checkbox" name="myname1677[]" value="option2">Option 2</label>
<label class="multi-select__option">
<input type="checkbox" name="myname1677[]" value="option3">Option 3</label>
</fieldset>
</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5004" class="form-label ">
Dateiupload
</label>
<input class="form-control" id="myInputField5004" type="file" name="myInputField5004">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7171" class="form-label ">
Time
</label>
<input class="form-control" id="myInputField7171" type="time" name="myInputField7171">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7862" class="form-label ">
Number
</label>
<input class="form-control" id="myInputField7862" type="number" name="myInputField7862">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7412" class="form-label ">
Url
</label>
<input class="form-control" id="myInputField7412" type="url" name="myInputField7412">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField2710" class="form-label ">
Datepicker native (input[type=date])
</label>
<input class="form-control" id="myInputField2710" type="date" name="myInputField2710">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField2642" class="form-label ">
Datepicker with flatpickr.js (input.datepicker)
</label>
<input class="form-control datepicker" id="myInputField2642" type="text" name="myInputField2642">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5086" class="form-label ">
Readonly
</label>
<input class="form-control" readonly id="myInputField5086" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField5086">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField8091" 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="myInputField8091" type="text" name="myInputField8091">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7998" class="form-label ">
Input as plaintext
</label>
<input class="form-control-plaintext" readonly id="myInputField7998" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField7998">
</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="myCheckbox9627" name="myCheckbox9627">
<label class="form-check-label" for="myCheckbox9627">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox3055" name="myCheckbox3055">
<label class="form-check-label" for="myCheckbox3055">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox9674" name="myCheckbox9674">
<label class="form-check-label" for="myCheckbox9674">Disabled checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox1300" name="myCheckbox1300">
<label class="form-check-label" for="myCheckbox1300">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="myCheckbox6755" name="myCheckbox6755">
<label class="form-check-label" for="myCheckbox6755">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="myCheckbox1484" name="exampleRadios">
<label class="form-check-label" for="myCheckbox1484">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox9963" name="exampleRadios">
<label class="form-check-label" for="myCheckbox9963">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" disabled id="myCheckbox6486" name="exampleRadios">
<label class="form-check-label" for="myCheckbox6486">Disabled radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox4564" name="exampleRadios">
<label class="form-check-label" for="myCheckbox4564">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="myCheckbox2834" name="exampleRadios">
<label class="form-check-label" for="myCheckbox2834">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="myCheckbox3542" name="myCheckbox3542">
<label class="form-check-label" for="myCheckbox3542">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox3230" name="myCheckbox3230">
<label class="form-check-label" for="myCheckbox3230">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox9002" name="myCheckbox9002">
<label class="form-check-label" for="myCheckbox9002">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="myCheckbox9863" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox9863">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox4460" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox4460">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" disabled id="myCheckbox1244" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox1244">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-4318" id="toggle-switch-4318" 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-4318">Receive Notifications</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-4469" id="toggle-switch-4469" 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-4469">Receive SMS</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-4663" id="toggle-switch-4663" 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-4663">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="myInputField1445" class="form-label ">
Passwort
</label>
<input class="form-control" id="myInputField1445" type="password" aria-describedby="myInputField1445Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField1445">
<small id="myInputField1445Help" 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="myInputField8141" class="form-label ">
Textfeld
</label>
<input class="form-control is-invalid" id="myInputField8141" type="text" aria-invalid="true" aria-describedby="myInputField8141Invalid " name="myInputField8141">
<p id="myInputField8141Invalid" 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="myCheckbox9779Invalid " id="myCheckbox9779" name="myCheckbox9779">
<label class="form-check-label" for="myCheckbox9779">Checkbox</label>
<p id="myCheckbox9779Invalid" 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="myFieldset807Invalid" id="myCheckbox5067" name="exampleRadios">
<label class="form-check-label" for="myCheckbox5067">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="myFieldset807Invalid" id="myCheckbox8350" name="exampleRadios">
<label class="form-check-label" for="myCheckbox8350">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="myFieldset807Invalid" id="myCheckbox6606" name="exampleRadios">
<label class="form-check-label" for="myCheckbox6606">Weniger zufrieden</label>
</div>
<p class="message message--error" id="myFieldset807Invalid">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="myInputField6725" class="form-label aural">
Textfeld
</label>
<input class="form-control" id="myInputField6725" type="text" name="myInputField6725">
</div>
<div class="form-group">
<label for="mySelect9864" class="form-label aural">
Auswahlliste
</label>
<select class="form-control" id="mySelect9864" name="mySelect9864"
>
<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="myCheckbox6117" name="myCheckbox6117">
<label class="form-check-label" for="myCheckbox6117">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="myInputField1998" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField1998" type="text" name="myInputField1998">
</div>
<div class="form-group">
<label for="myInputField5865" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField5865" type="text" name="myInputField5865">
</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="myInputField4475" 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="myInputField4475" type="text" aria-describedby="myInputField4475Help " name="myInputField4475">
<small id="myInputField4475Help" class="formgroup__help">Helptext</small>
</div>
<div class="form-group">
<label for="mySelect4034" 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="mySelect4034" aria-describedby="mySelect4034Help " name="mySelect4034"
>
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<small id="mySelect4034Help" 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="myCheckbox7985" name="myCheckbox7985">
<label class="form-check-label" for="myCheckbox7985">Antwort 1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox3826" name="myCheckbox3826">
<label class="form-check-label" for="myCheckbox3826">Antwort 2</label>
</div>
</fieldset>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox9998" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox9998">Ja</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox2762" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox2762">Nein</label>
</div>
</fieldset>
<div class="form-actions"> <div class="form-actions__left">
<a href="#randomtarget6870" 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="myInputField7554" 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="myInputField7554" type="text" name="myInputField7554">
</div>
<div class="form-group">
<label for="myInputField2280" 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="myInputField2280" type="password" name="myInputField2280">
</div>
<div class="form-actions">
<button type="submit" class="button">Anmelden</button>
</div>
</form>