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="myInputField8802" 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="myInputField8802" type="text" aria-describedby="myInputField8802Help " name="myInputField8802">
        <small id="myInputField8802Help" class="formgroup__help">Helptext</small>
    </div>
<div class="form-group"> 
    <label for="mySelect2794" 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="mySelect2794" aria-describedby="mySelect2794Help " name="mySelect2794">
        <option value="">Bitte wählen</option>
        <option value="option1">Option1</option>
        <option value="option2">Option2</option>
    </select>
    <small id="mySelect2794Help" 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="myCheckbox8359" name="myCheckbox8359">
                <label class="form-check-label" for="myCheckbox8359">Antwort 1</label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="checkbox" id="myCheckbox9731" name="myCheckbox9731">
                <label class="form-check-label" for="myCheckbox9731">Antwort 2</label>
            </div>
    </fieldset>

    <fieldset >
        <legend >
                Frage
        </legend>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="radio" id="myCheckbox3080" name="exampleRadios1">
                <label class="form-check-label" for="myCheckbox3080">Ja</label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="radio" id="myCheckbox8748" name="exampleRadios1">
                <label class="form-check-label" for="myCheckbox8748">Nein</label>
            </div>
    </fieldset>
    <div class="form-actions">
        <div class="form-actions__left">
            
            <a href="#randomtarget593" 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="myInputField6515" class="form-label ">
            Textfeld
        </label> 
        <input class="form-control" id="myInputField6515" type="text" name="myInputField6515">
    </div>
</form>
 
<form class="form--base panel--heavy">
<div class="form-group"> 
    <label for="mySelect6788" class="form-label">
        Select        
    </label>
    <select class="form-control" id="mySelect6788" name="mySelect6788">
        <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="mySelect5368" class="form-label">
        Multiselect        
    </label>
    <select class="form-control" multiple id="mySelect5368" name="mySelect5368">
        <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="myTextarea8910" class="form-label ">
            Textarea
        </label>
        <textarea class="form-control" id="myTextarea8910" rows="3" name="myTextarea8910"></textarea>
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField4674" class="form-label ">
            Dateiupload
        </label> 
        <input class="form-control" id="myInputField4674" type="file" name="myInputField4674">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField2057" class="form-label ">
            Time
        </label> 
        <input class="form-control" id="myInputField2057" type="time" name="myInputField2057">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField125" class="form-label ">
            Number
        </label> 
        <input class="form-control" id="myInputField125" type="number" name="myInputField125">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField713" class="form-label ">
            Url
        </label> 
        <input class="form-control" id="myInputField713" type="url" name="myInputField713">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField5700" class="form-label ">
            Datepicker native (input[type=date])
        </label> 
        <input class="form-control" id="myInputField5700" type="date" name="myInputField5700">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField3386" class="form-label ">
            Datepicker with flatpickr.js (input.datepicker)
        </label> 
        <input class="form-control datepicker" id="myInputField3386" type="text" name="myInputField3386">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField5021" class="form-label ">
            Readonly
        </label> 
        <input class="form-control" readonly id="myInputField5021" type="text" value="Dieser Text ist nicht zu ändern" name="myInputField5021">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField3492" 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="myInputField3492" type="text" name="myInputField3492">
    </div>
</form>
 
<form class="form--base panel--heavy">
   <div class="form-group">
        <label for="myInputField4303" class="form-label ">
            Input as plaintext
        </label> 
        <input class="form-control-plaintext" readonly id="myInputField4303" type="text" value="Dieser Wert sieht aus wie Plaintext" name="myInputField4303">
    </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="myCheckbox9837" name="myCheckbox9837">
                <label class="form-check-label" for="myCheckbox9837">Checkbox label</label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="checkbox" id="myCheckbox5313" name="myCheckbox5313">
                <label class="form-check-label" for="myCheckbox5313">Checkbox label</label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="checkbox" disabled id="myCheckbox6869" name="myCheckbox6869">
                <label class="form-check-label" for="myCheckbox6869">Disabled checkbox label</label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="checkbox" id="myCheckbox6741" name="myCheckbox6741">
                <label class="form-check-label" for="myCheckbox6741">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="myCheckbox1805" name="myCheckbox1805">
                <label class="form-check-label" for="myCheckbox1805">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="myCheckbox3824" name="exampleRadios">
                <label class="form-check-label" for="myCheckbox3824">Radio label</label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="radio" id="myCheckbox8321" name="exampleRadios">
                <label class="form-check-label" for="myCheckbox8321">Radio label</label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="radio" disabled id="myCheckbox7368" name="exampleRadios">
                <label class="form-check-label" for="myCheckbox7368">Disabled radio label</label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="radio" id="myCheckbox2125" name="exampleRadios">
                <label class="form-check-label" for="myCheckbox2125">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="myCheckbox2931" name="exampleRadios">
                <label class="form-check-label" for="myCheckbox2931">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="myCheckbox4956" name="myCheckbox4956">
                <label class="form-check-label" for="myCheckbox4956">Checkbox label</label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="checkbox" id="myCheckbox9655" name="myCheckbox9655">
                <label class="form-check-label" for="myCheckbox9655">Checkbox label</label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="checkbox" disabled id="myCheckbox7951" name="myCheckbox7951">
                <label class="form-check-label" for="myCheckbox7951">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="myCheckbox1474" name="exampleRadios2">
                <label class="form-check-label" for="myCheckbox1474">Radio button label</label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="radio" id="myCheckbox8310" name="exampleRadios2">
                <label class="form-check-label" for="myCheckbox8310">Radio button label</label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="radio" disabled id="myCheckbox1310" name="exampleRadios2">
                <label class="form-check-label" for="myCheckbox1310">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-5394" id="toggle-switch-5394" 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-5394">Receive Notifications</label>
        </div>

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

        <div class="toggle-switch form-check">
          <input type="checkbox" name="toggle-switch-input-2467" id="toggle-switch-2467" 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-2467">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="myInputField5870" class="form-label ">
            Passwort
        </label> 
        <input class="form-control" id="myInputField5870" type="password" aria-describedby="myInputField5870Help " placeholder="Geben Sie hier Ihr passwort ein" name="myInputField5870">
        <small id="myInputField5870Help" 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="myInputField1496" class="form-label ">
            Textfeld
        </label> 
        <input class="form-control is-invalid" id="myInputField1496" type="text" aria-describedby="myInputField1496Invalid " name="myInputField1496">
        <div class="message message--error" id="myInputField1496Invalid">
        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="myInputField8216" class="form-label ">
            Textfeld
        </label> 
        <input class="form-control is-valid" id="myInputField8216" type="text" aria-describedby="myInputField8216Valid " value="Ich bin ein Text" name="myInputField8216">
        <div class="message message--success" id="myInputField8216Valid">
        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="myCheckbox3536Invalid " id="myCheckbox3536" name="myCheckbox3536">
                <label class="form-check-label" for="myCheckbox3536">Checkbox</label>
                <div id="myCheckbox3536Invalid" 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="myCheckbox2068Valid " id="myCheckbox2068" name="myCheckbox2068">
                <label class="form-check-label" for="myCheckbox2068">Checkbox</label>
                <div id="myCheckbox2068Valid" 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="myInputField3335" class="form-label aural">
            Textfeld
        </label> 
        <input class="form-control" id="myInputField3335" type="text" name="myInputField3335">
    </div>
<div class="form-group"> 
    <label for="mySelect4947" class="form-label aural">
        Auswahlliste        
    </label>
    <select class="form-control" id="mySelect4947" name="mySelect4947">
        <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="myCheckbox1258" name="myCheckbox1258">
                <label class="form-check-label" for="myCheckbox1258">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="myInputField9012" class="form-label ">
            Textfeld
        </label> 
        <input class="form-control" id="myInputField9012" type="text" name="myInputField9012">
    </div>
   <div class="form-group">
        <label for="myInputField6870" class="form-label ">
            Textfeld
        </label> 
        <input class="form-control" id="myInputField6870" type="text" name="myInputField6870">
    </div>
<button type="submit" class="button">Button</button>
</div></form>