Skip to the content
Konstruktor UI

Actions and inputs

Field and text input

A field is a label, the control, an optional hint and an error message. .kui-input styles a native text input, .kui-textarea a text area.

CSS only

Examples

A field with a label and a hint

As it is written on your identity card.

HTML
<div class="kui-field">
  <label class="kui-label" for="f-name">Full name</label>
  <input class="kui-input" id="f-name" name="name" autocomplete="name" aria-describedby="f-name-hint">
  <p class="kui-hint" id="f-name-hint">As it is written on your identity card.</p>
</div>

Required, optional and invalid

The input carries required; the asterisk is only what the eye sees. An invalid field has aria-invalid="true" and its message is linked with aria-describedby.

Enter an email address, such as name@example.com.

HTML
<div class="kui-field">
  <label class="kui-label" for="f-mail">Email<span class="kui-required" aria-hidden="true">*</span></label>
  <input class="kui-input" id="f-mail" type="email" required aria-invalid="true" aria-describedby="f-mail-error" value="name@">
  <p class="kui-error-text" id="f-mail-error"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#circle-alert"></use></svg><span>Enter an email address, such as name@example.com.</span></p>
</div>
<div class="kui-field">
  <label class="kui-label" for="f-co">Company<span class="kui-optional">optional</span></label>
  <input class="kui-input" id="f-co" autocomplete="organization">
</div>

Text area

HTML
<div class="kui-field">
  <label class="kui-label" for="f-msg">Message</label>
  <textarea class="kui-textarea" id="f-msg" rows="4" placeholder="Write what happened, in your own words."></textarea>
</div>

With an icon or a unit

RSD
HTML
<div class="kui-field">
  <label class="kui-label" for="f-amount">Amount</label>
  <div class="kui-input-wrap">
    <input class="kui-input" id="f-amount" inputmode="decimal" value="1 250,00">
    <span class="kui-input-wrap__affix">RSD</span>
  </div>
</div>
<div class="kui-field">
  <label class="kui-label" for="f-site">Website</label>
  <div class="kui-input-wrap"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#globe"></use></svg><input class="kui-input" id="f-site" type="url" placeholder="https://"></div>
</div>

States

Every state

Use digits only.

HTML
<div class="kui-form kui-form--wide">
<div class="kui-form__row">
  <div class="kui-field"><label class="kui-label" for="s-1">Default</label><input class="kui-input" id="s-1" placeholder="Placeholder"></div>
  <div class="kui-field"><label class="kui-label" for="s-2">Filled</label><input class="kui-input" id="s-2" value="Šabac, Srbija"></div>
  <div class="kui-field"><label class="kui-label" for="s-3">Disabled</label><input class="kui-input" id="s-3" value="Cannot change" disabled></div>
  <div class="kui-field"><label class="kui-label" for="s-4">Read only</label><input class="kui-input" id="s-4" value="INV-2026-0142" readonly></div>
  <div class="kui-field"><label class="kui-label" for="s-5">Invalid</label><input class="kui-input" id="s-5" aria-invalid="true" aria-describedby="s-5-e" value="12a"><p class="kui-error-text" id="s-5-e"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#circle-alert"></use></svg><span>Use digits only.</span></p></div>
  <div class="kui-field"><label class="kui-label" for="s-6">Monospace</label><input class="kui-input kui-input--mono" id="s-6" value="RS35 1050 0812 3123 1231 73"></div>
</div>
</div>

Classes and attributes

.kui-field
The column that holds a label, the control, a hint and an error.
.kui-label, .kui-hint, .kui-error-text
The label, the hint under the control, the error message (hidden when empty).
.kui-required, .kui-optional
The visible mark of a required or an optional field.
.kui-input, .kui-textarea
A text input or a text area. --sm, --lg and --mono change size and face.
.kui-input-wrap
An input with an icon (.kui-icon before it) or a unit (.kui-input-wrap__affix after it).
aria-invalid="true"
Marks the control invalid; link the message with aria-describedby.

Keyboard

Tab
Moves to the next field.

Accessibility

  • Every control has a visible label tied with for; a placeholder is never the label.
  • On a phone the text is 16 pixels so the browser does not zoom in.
  • Use the right type, inputmode and autocomplete so phones show the right keyboard and can fill the field.
  • The outline of a field keeps 3:1 against the surface (the border-control token).

Do and do not

Do

  • Say in the hint what format is expected before the person types.
  • Write the error as what to do: “Enter a date after today”.
  • Keep a field as wide as the value it expects.

Do not

  • Do not use the placeholder for the label or the hint: it disappears when typing starts.
  • Do not show an error before the person has left the field or submitted.
  • Do not split one value (an IBAN, a phone number) into several fields.