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 Beispielen gefüllt werden.

Example

Hinweis: Pflichfelder sind mit einem (Pflichtfeld) markiert.

Helptext
Helptext
Frage
Frage
<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="myInputField5638" 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="myInputField5638" type="text" aria-describedby="myInputField5638Help " name="myInputField5638">
        <small id="myInputField5638Help" class="formgroup__help">Helptext</small>
    </div>
<div class="form-group"> 
    <label for="mySelect6820" 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="mySelect6820" aria-describedby="mySelect6820Help " name="mySelect6820">
        <option value="">Bitte wählen</option>
        <option value="option1">Option1</option>
        <option value="option2">Option2</option>
    </select>
    <small id="mySelect6820Help" 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="myCheckbox8352" name="myCheckbox8352">
                <label class="form-check-label" for="myCheckbox8352">Antwort 1</label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="checkbox" id="myCheckbox933" name="myCheckbox933">
                <label class="form-check-label" for="myCheckbox933">Antwort 2</label>
            </div>
    </fieldset>

    <fieldset >
        <legend >
                Frage
        </legend>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="radio" id="myCheckbox4467" name="exampleRadios1">
                <label class="form-check-label" for="myCheckbox4467">Ja</label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="radio" id="myCheckbox8005" name="exampleRadios1">
                <label class="form-check-label" for="myCheckbox8005">Nein</label>
            </div>
    </fieldset>
    <div class="form-actions">
        <div class="form-actions__left">
            
            <a href="#randomtarget4343" 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>
 

Form elements

<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField14" class="form-label ">
            Textfeld
        </label> 
        <input class="form-control" id="myInputField14" type="text" name="myInputField14">
    </div>
</form>
 
<form class="form--base panel--heavy">
<div class="form-group"> 
    <label for="mySelect5631" class="form-label">
        Select        
    </label>
    <select class="form-control" id="mySelect5631" name="mySelect5631">
        <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="mySelect439" class="form-label">
        Multiselect        
    </label>
    <select class="form-control" multiple id="mySelect439" name="mySelect439">
        <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="myTextarea7492" class="form-label ">
            Textarea
        </label>
        <textarea class="form-control" id="myTextarea7492" rows="3" name="myTextarea7492"></textarea>
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField350" class="form-label ">
            Dateiupload
        </label> 
        <input class="form-control" id="myInputField350" type="file" name="myInputField350">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField5492" class="form-label ">
            Time
        </label> 
        <input class="form-control" id="myInputField5492" type="time" name="myInputField5492">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField8856" class="form-label ">
            Number
        </label> 
        <input class="form-control" id="myInputField8856" type="number" name="myInputField8856">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField6392" class="form-label ">
            Url
        </label> 
        <input class="form-control" id="myInputField6392" type="url" name="myInputField6392">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField2764" class="form-label ">
            Datepicker native (input[type=date])
        </label> 
        <input class="form-control" id="myInputField2764" type="date" name="myInputField2764">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField7005" class="form-label ">
            Datepicker with flatpickr.js (input.datepicker)
        </label> 
        <input class="form-control datepicker" id="myInputField7005" type="text" name="myInputField7005">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField3648" class="form-label ">
            Readonly
        </label> 
        <input class="form-control" readonly id="myInputField3648" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField3648">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField7348" 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="myInputField7348" type="text" name="myInputField7348">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField5243" class="form-label ">
            Input as plaintext
        </label> 
        <input class="form-control-plaintext" readonly id="myInputField5243" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField5243">
    </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

Checkboxes legend
<form class="form--base panel--heavy">

    <fieldset >
        <legend >
                Checkboxes legend
        </legend>
            <div class="form-check">
                <input class="form-check-input" type="checkbox" id="myCheckbox4206" name="myCheckbox4206">
                <label class="form-check-label" for="myCheckbox4206">Checkbox label</label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="checkbox" id="myCheckbox9324" name="myCheckbox9324">
                <label class="form-check-label" for="myCheckbox9324">Checkbox label</label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="checkbox" disabled id="myCheckbox7201" name="myCheckbox7201">
                <label class="form-check-label" for="myCheckbox7201">Disabled checkbox label</label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="checkbox" id="myCheckbox1434" name="myCheckbox1434">
                <label class="form-check-label" for="myCheckbox1434">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="myCheckbox2906" name="myCheckbox2906">
                <label class="form-check-label" for="myCheckbox2906">Checkbox label</label>
            </div>
    </fieldset>
</form>
 
Radio button legend
<form class="form--base panel--heavy">

    <fieldset >
        <legend >
                Radio button legend
        </legend>
            <div class="form-check">
                <input class="form-check-input" type="radio" id="myCheckbox6647" name="exampleRadios">
                <label class="form-check-label" for="myCheckbox6647">Radio label</label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="radio" id="myCheckbox8027" name="exampleRadios">
                <label class="form-check-label" for="myCheckbox8027">Radio label</label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="radio" disabled id="myCheckbox1692" name="exampleRadios">
                <label class="form-check-label" for="myCheckbox1692">Disabled radio label</label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="radio" id="myCheckbox9506" name="exampleRadios">
                <label class="form-check-label" for="myCheckbox9506">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="myCheckbox8419" name="exampleRadios">
                <label class="form-check-label" for="myCheckbox8419">Radio label</label>
            </div>
    </fieldset>
</form>
 

Inline Checkboxen: Checkboxen und Radios können mit der Klasse .form-check-inline horizontal gruppiert werden.

Inline checkboxes legend
<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="myCheckbox4681" name="myCheckbox4681">
                <label class="form-check-label" for="myCheckbox4681">Checkbox label</label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="checkbox" id="myCheckbox7264" name="myCheckbox7264">
                <label class="form-check-label" for="myCheckbox7264">Checkbox label</label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="checkbox" disabled id="myCheckbox843" name="myCheckbox843">
                <label class="form-check-label" for="myCheckbox843">Disabled checkbox label</label>
            </div>
    </fieldset>
</form>
 
Inline radio buttons legend
<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="myCheckbox9400" name="exampleRadios2">
                <label class="form-check-label" for="myCheckbox9400">Radio button label</label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="radio" id="myCheckbox8421" name="exampleRadios2">
                <label class="form-check-label" for="myCheckbox8421">Radio button label</label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="radio" disabled id="myCheckbox2114" name="exampleRadios2">
                <label class="form-check-label" for="myCheckbox2114">Disabled Radio button label</label>
            </div>
    </fieldset>
</form>
 

Toggle switch

Bitte beachten Sie
Toggle Switches sind An- und Ausschalter, die unmittelbar eine Aktion auslösen, ohne dass der Benutzer oder die Benutzerin auf „Speichern“ oder „Absenden“ klicken muss, um den neuen Zustand zu übernehmen. Toggle Switches sind zwar technisch Checkboxen sollten aber nicht als solche verwendet werden. Für weitere Informationen empfehlen wir die Toggle-Switch-Richtlinien der Nielsen Norman Group.

Settings
<form class="form--base panel--heavy">

    <fieldset >
        <legend >
                Settings
        </legend>

        <div class="toggle-switch form-check">
          <input type="checkbox" name="toggle-switch-input-4754" id="toggle-switch-4754" 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-4754">Receive Notifications</label>
        </div>

        <div class="toggle-switch form-check">
          <input type="checkbox" name="toggle-switch-input-2216" id="toggle-switch-2216" 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-2216">Receive SMS</label>
        </div>

        <div class="toggle-switch form-check">
          <input type="checkbox" name="toggle-switch-input-9879" id="toggle-switch-9879" 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-9879">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.

We never share your email with anyone else.
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField2236" class="form-label ">
            Passwort
        </label> 
        <input class="form-control" id="myInputField2236" type="password" aria-describedby="myInputField2236Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField2236">
        <small id="myInputField2236Help" 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.

Bitte füllen Sie dieses Feld aus.
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField2041" class="form-label ">
            Textfeld
        </label> 
        <input class="form-control is-invalid" id="myInputField2041" type="text" aria-describedby="myInputField2041Invalid " name="myInputField2041">
        <div class="message message--error" id="myInputField2041Invalid">
        Bitte füllen Sie dieses Feld aus.    
</div>
    </div>
</form>
 
Dieses Feld ist richtig ausgefüllt.
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField2134" class="form-label ">
            Textfeld
        </label> 
        <input class="form-control is-valid" id="myInputField2134" type="text" aria-describedby="myInputField2134Valid " value="Ich bin ein Text" name="myInputField2134">
        <div class="message message--success" id="myInputField2134Valid">
        Dieses Feld ist richtig ausgefüllt.    
</div>
    </div>
</form>
 
Bitte füllen Sie dieses Feld aus.
<form class="form--base panel--heavy">
            <div class="form-check">
                <input class="form-check-input is-invalid" type="checkbox" aria-describedby="myCheckbox4681Invalid " id="myCheckbox4681" name="myCheckbox4681">
                <label class="form-check-label" for="myCheckbox4681">Checkbox</label>
                <div id="myCheckbox4681Invalid" class="message message--error">Bitte füllen Sie dieses Feld aus.</div>
            </div>
</form>
 
Dieses Feld ist richtig ausgefüllt.
<form class="form--base panel--heavy">
            <div class="form-check">
                <input class="form-check-input is-valid" type="checkbox" aria-describedby="myCheckbox1983Valid " id="myCheckbox1983" name="myCheckbox1983">
                <label class="form-check-label" for="myCheckbox1983">Checkbox</label>
                <div id="myCheckbox1983Valid" 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="myInputField7658" class="form-label aural">
            Textfeld
        </label> 
        <input class="form-control" id="myInputField7658" type="text" name="myInputField7658">
    </div>
<div class="form-group"> 
    <label for="mySelect9091" class="form-label aural">
        Auswahlliste        
    </label>
    <select class="form-control" id="mySelect9091" name="mySelect9091">
        <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="myCheckbox9225" name="myCheckbox9225">
                <label class="form-check-label" for="myCheckbox9225">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="myInputField5614" class="form-label ">
            Textfeld
        </label> 
        <input class="form-control" id="myInputField5614" type="text" name="myInputField5614">
    </div>
   <div class="form-group">
        <label for="myInputField8787" class="form-label ">
            Textfeld
        </label> 
        <input class="form-control" id="myInputField8787" type="text" name="myInputField8787">
    </div>
<button type="submit" class="button">Button</button>
</div></form>