Skip to content
Theme
endue.ai

Components, Forms

Form fields

Binds a label, a hint and an error message to one input control.

Name in code Field

This name appears in conversations and notifications.

Use lowercase letters, numbers and hyphens only.

You can change this later in Studio.

A field binds a label, a hint and an error to one input control. The control is one of TextInput, TextArea, Select or SearchField.

Anatomy

  • Label: 12px, weight 500, muted-foreground, 6px above the control. A required field adds a * in destructive-text.
  • Control: height 40px (md, the default) or 32px (sm), 12px horizontal padding, 8px corner radius, a background surface and a 1px input border. Text is 14px. Below 640px it is 16px, which prevents zoom on mobile.
  • Focus: the border changes to ring and a 1px ring is added. ring is ink. The global focus ring does not stack on top of it.
  • Error: with aria-invalid="true" the border is destructive, and the message below is 12px destructive-text.
  • Hint: 12px muted-foreground.
  • TextArea: at least 80px tall. It resizes vertically only.
  • Select: a native select with a 16px ChevronDown drawn on it.
  • SearchField: a leading 16px Search icon, the input, and a clear button (IconButton xs) when there is a value.

What you provide

  • label: always provide it. If it should not be visible, hideLabel hides it visually only.
  • hint and error: an error says what went wrong and how to fix it, in one sentence.
  • A placeholder is only an example. It does not replace the label.

Markup

<div class="Field_field">
  <label for="name" class="Field_label">Name<span class="Field_required" aria-hidden="true">*</span></label>
  <input id="name" type="text" class="Field_control" aria-describedby="name-hint" required>
  <p id="name-hint" class="Field_hint">This name appears in conversations and notifications.</p>
</div>

<span class="Field_selectWrap">
  <select class="Field_select">…</select>
  <span class="Field_selectIcon" aria-hidden="true"><svg>…</svg></span>
</span>

<div class="Field_search">
  <span class="Field_searchIcon" aria-hidden="true"><svg>…</svg></span>
  <input type="text" class="Field_searchInput" aria-label="Search connectors">
</div>

<textarea class="Field_textarea"></textarea>

For the small size, add Field_sm to the control (or to Field_search).

Don’t

  • Don’t use the input color as a background. It is for borders only.
  • Don’t mix controls of different heights in one row.