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="myInputField4946" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField4946" type="text" name="myInputField4946">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="mySelect6513" class="form-label">
Select
</label>
<select class="form-control" id="mySelect6513" name="mySelect6513">
<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="mySelect981" class="form-label">
Multiselect
</label>
<select class="form-control" multiple id="mySelect981" name="mySelect981">
<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="myTextarea4025" class="form-label ">
Textarea
</label>
<textarea class="form-control" id="myTextarea4025" rows="3" name="myTextarea4025"></textarea>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5499" class="form-label ">
Dateiupload
</label>
<input class="form-control" id="myInputField5499" type="file" name="myInputField5499">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField5703" class="form-label ">
Time
</label>
<input class="form-control" id="myInputField5703" type="time" name="myInputField5703">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField7292" class="form-label ">
Number
</label>
<input class="form-control" id="myInputField7292" type="number" name="myInputField7292">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField3773" class="form-label ">
Url
</label>
<input class="form-control" id="myInputField3773" type="url" name="myInputField3773">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1431" class="form-label ">
Datepicker native (input[type=date])
</label>
<input class="form-control" id="myInputField1431" type="date" name="myInputField1431">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9191" class="form-label ">
Datepicker with flatpickr.js (input.datepicker)
</label>
<input class="form-control datepicker" id="myInputField9191" type="text" name="myInputField9191">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1830" class="form-label ">
Readonly
</label>
<input class="form-control" readonly id="myInputField1830" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField1830">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField1683" 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="myInputField1683" type="text" name="myInputField1683">
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField585" class="form-label ">
Input as plaintext
</label>
<input class="form-control-plaintext" readonly id="myInputField585" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField585">
</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="myCheckbox8368" name="myCheckbox8368">
<label class="form-check-label" for="myCheckbox8368">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox583" name="myCheckbox583">
<label class="form-check-label" for="myCheckbox583">Checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox3353" name="myCheckbox3353">
<label class="form-check-label" for="myCheckbox3353">Disabled checkbox label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="myCheckbox7425" name="myCheckbox7425">
<label class="form-check-label" for="myCheckbox7425">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="myCheckbox2507" name="myCheckbox2507">
<label class="form-check-label" for="myCheckbox2507">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="myCheckbox2271" name="exampleRadios">
<label class="form-check-label" for="myCheckbox2271">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox8698" name="exampleRadios">
<label class="form-check-label" for="myCheckbox8698">Radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" disabled id="myCheckbox3683" name="exampleRadios">
<label class="form-check-label" for="myCheckbox3683">Disabled radio label</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" id="myCheckbox8310" name="exampleRadios">
<label class="form-check-label" for="myCheckbox8310">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="myCheckbox9501" name="exampleRadios">
<label class="form-check-label" for="myCheckbox9501">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="myCheckbox6955" name="myCheckbox6955">
<label class="form-check-label" for="myCheckbox6955">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox6226" name="myCheckbox6226">
<label class="form-check-label" for="myCheckbox6226">Checkbox label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" disabled id="myCheckbox4771" name="myCheckbox4771">
<label class="form-check-label" for="myCheckbox4771">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="myCheckbox7551" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox7551">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox408" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox408">Radio button label</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" disabled id="myCheckbox6127" name="exampleRadios2">
<label class="form-check-label" for="myCheckbox6127">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-955" id="toggle-switch-955" 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-955">Receive Notifications</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-7523" id="toggle-switch-7523" 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-7523">Receive SMS</label>
</div>
<div class="toggle-switch form-check">
<input type="checkbox" name="toggle-switch-input-8115" id="toggle-switch-8115" 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-8115">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="myInputField8316" class="form-label ">
Passwort
</label>
<input class="form-control" id="myInputField8316" type="password" aria-describedby="myInputField8316Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField8316">
<small id="myInputField8316Help" 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="myInputField1256" class="form-label ">
Textfeld
</label>
<input class="form-control is-invalid" id="myInputField1256" type="text" aria-describedby="myInputField1256Invalid " name="myInputField1256">
<div class="message message--error" id="myInputField1256Invalid">
Bitte füllen Sie dieses Feld aus.
</div>
</div>
</form>
<form class="form--base panel--heavy">
<div class="form-group">
<label for="myInputField9092" class="form-label ">
Textfeld
</label>
<input class="form-control is-valid" id="myInputField9092" type="text" aria-describedby="myInputField9092Valid " value="Ich bin ein Text" name="myInputField9092">
<div class="message message--success" id="myInputField9092Valid">
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="myCheckbox6397Invalid " id="myCheckbox6397" name="myCheckbox6397">
<label class="form-check-label" for="myCheckbox6397">Checkbox</label>
<div id="myCheckbox6397Invalid" 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="myCheckbox2546Valid " id="myCheckbox2546" name="myCheckbox2546">
<label class="form-check-label" for="myCheckbox2546">Checkbox</label>
<div id="myCheckbox2546Valid" 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="myInputField5000" class="form-label aural">
Textfeld
</label>
<input class="form-control" id="myInputField5000" type="text" name="myInputField5000">
</div>
<div class="form-group">
<label for="mySelect3569" class="form-label aural">
Auswahlliste
</label>
<select class="form-control" id="mySelect3569" name="mySelect3569">
<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="myCheckbox3363" name="myCheckbox3363">
<label class="form-check-label" for="myCheckbox3363">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="myInputField3153" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField3153" type="text" name="myInputField3153">
</div>
<div class="form-group">
<label for="myInputField9671" class="form-label ">
Textfeld
</label>
<input class="form-control" id="myInputField9671" type="text" name="myInputField9671">
</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="myInputField5935" 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="myInputField5935" type="text" aria-describedby="myInputField5935Help " name="myInputField5935">
<small id="myInputField5935Help" class="formgroup__help">Helptext</small>
</div>
<div class="form-group">
<label for="mySelect3299" 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="mySelect3299" aria-describedby="mySelect3299Help " name="mySelect3299">
<option value="">Bitte wählen</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
</select>
<small id="mySelect3299Help" 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="myCheckbox5374" name="myCheckbox5374">
<label class="form-check-label" for="myCheckbox5374">Antwort 1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="myCheckbox6306" name="myCheckbox6306">
<label class="form-check-label" for="myCheckbox6306">Antwort 2</label>
</div>
</fieldset>
<fieldset >
<legend >
Frage
</legend>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox4016" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox4016">Ja</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="myCheckbox4906" name="exampleRadios1">
<label class="form-check-label" for="myCheckbox4906">Nein</label>
</div>
</fieldset>
<div class="form-actions"> <div class="form-actions__left">
<a href="#randomtarget5782" 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="myInputField6028" 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="myInputField6028" type="text" name="myInputField6028">
</div>
<div class="form-group">
<label for="myInputField2206" 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="myInputField2206" type="password" name="myInputField2206">
</div>
<div class="form-actions">
<button type="submit" class="button">Anmelden</button>
</div>
</form>