VERIFICATION-0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
Type to filter available projects.
<forma-combobox>
Searchable selection baseline that preserves direct text entry and native semantics.
<forma-combobox>patterns/combobox.htmlA combobox is a text input with suggestions: the user can type to narrow a list or enter a value directly. Forma's baseline is a native input linked to a datalist with the list attribute, so the browser supplies suggestion matching, the suggestion popup and keyboard selection with no script. .forma-combobox lays out the label, control, a decorative indicator and help text. Asynchronous suggestions, loading/no-result/error states, rich options and full WAI-ARIA combobox keyboard behavior are Limen/application enhancements layered on the same visual contract.
The smallest correct markup: the canonical pattern from patterns/combobox.html inside its public tag. Copy this first, then adapt labels, names and state.
Rendered from the canonical pattern file.
Type to filter available projects.
<forma-combobox class="forma-component-tag">
<div class="forma-combobox">
<label for="combo-project">Project</label>
<div class="forma-combobox__control">
<input id="combo-project" name="project" list="project-options" autocomplete="off" placeholder="Search projects">
<span class="forma-combobox__indicator" aria-hidden="true">⌄</span>
</div>
<datalist id="project-options">
<option value="Architecture assessment"></option>
<option value="Signal research"></option>
<option value="Platform modernization"></option>
</datalist>
<p class="forma-combobox__help">Type to filter available projects.</p>
</div>
</forma-combobox>
Click or tap the code once to select all of it, then copy.
Existing labels are suggested, but a new label can be typed and submitted as is. The help text says so and is linked with aria-describedby.
Choose an existing label or type a new one.
<forma-combobox class="forma-component-tag">
<div class="forma-combobox">
<label for="combobox-free-entry-label">Label</label>
<div class="forma-combobox__control">
<input id="combobox-free-entry-label" name="label" list="combobox-free-entry-options" autocomplete="off" aria-describedby="combobox-free-entry-help">
<span class="forma-combobox__indicator" aria-hidden="true">⌄</span>
</div>
<datalist id="combobox-free-entry-options">
<option value="bug"></option>
<option value="customer-reported"></option>
<option value="needs-design"></option>
<option value="performance"></option>
</datalist>
<p class="forma-combobox__help" id="combobox-free-entry-help">Choose an existing label or type a new one.</p>
</div>
</forma-combobox>
Click or tap the code once to select all of it, then copy.
Only listed cost centers are accepted. The application checked the typed value on submit, marked the input with aria-invalid and linked a validation message after the help text; the typed text is kept for correction.
Type to filter cost centers.
<forma-combobox class="forma-component-tag">
<div class="forma-combobox">
<label for="combobox-unrecognized-cost-center">Cost center</label>
<div class="forma-combobox__control">
<input id="combobox-unrecognized-cost-center" name="cost-center" list="combobox-unrecognized-options" autocomplete="off" value="Marketting" required aria-invalid="true" aria-describedby="combobox-unrecognized-help combobox-unrecognized-error">
<span class="forma-combobox__indicator" aria-hidden="true">⌄</span>
</div>
<datalist id="combobox-unrecognized-options">
<option value="Engineering"></option>
<option value="Finance"></option>
<option value="Marketing"></option>
<option value="Operations"></option>
</datalist>
<p class="forma-combobox__help" id="combobox-unrecognized-help">Type to filter cost centers.</p>
<p class="forma-validation-message" id="combobox-unrecognized-error">
<span class="forma-validation-message__mark" aria-hidden="true">!</span>
No cost center called "Marketting". Choose one from the list.
</p>
</div>
</forma-combobox>
Click or tap the code once to select all of it, then copy.
Each mobile example renders in its own document inside a real narrow viewport, so Forma's media and container queries run exactly as they would on a phone. Choose a width to compare.
An assignee combobox at phone width. The input fills the width and the platform shows suggestions in its own UI.
<forma-combobox class="forma-component-tag">
<div class="forma-combobox">
<label for="combobox-mobile-assignee">Assign to</label>
<div class="forma-combobox__control">
<input id="combobox-mobile-assignee" name="assignee" list="combobox-mobile-assignee-options" autocomplete="off" aria-describedby="combobox-mobile-assignee-help">
<span class="forma-combobox__indicator" aria-hidden="true">⌄</span>
</div>
<datalist id="combobox-mobile-assignee-options">
<option value="Amara Okafor"></option>
<option value="Jonas Lindqvist"></option>
<option value="Priya Raman"></option>
</datalist>
<p class="forma-combobox__help" id="combobox-mobile-assignee-help">Type a name. Leave empty to keep the item unassigned.</p>
</div>
</forma-combobox>
Click or tap the code once to select all of it, then copy.
The canonical pattern in a true 320px viewport, the minimum width every Forma component must support without page-level horizontal scrolling.
Forma components have no JavaScript API. Their public contract is the markup: native elements and attributes you write, and the CSS hooks below. The CSS hook table is generated from the built stylesheet, so it always matches the shipped implementation.
| Attribute | On | Values | Default | Description |
|---|---|---|---|---|
list | input | id of a datalist | — | Connects the native suggestion list. Required for the no-script baseline. |
for | label | id of the input | — | Associates the visible label. |
name | input | string | — | Form field name; the typed text is what is submitted. |
autocomplete | input | off | browser heuristic | Stops the browser's form history from mixing with the datalist suggestions. |
value | option | string | — | Suggested value inside the datalist. |
placeholder | input | string | — | Optional example text; never a replacement for the label. |
required | input | boolean | absent | Native constraint against an empty value; does not require a listed value. |
aria-describedby | input | id list | — | Links the help text and any validation message. |
aria-invalid | input | true | absent | Set by the application when the typed value is not accepted. |
| Hook | Kind | Values or default | Description |
|---|---|---|---|
.forma-combobox | Block class | — | Root grid (0.5rem gap). A direct child label gets the compact field-label style. |
.forma-combobox__control | Element class | — | Positioning wrapper around the input and indicator. |
.forma-combobox__help | Element class | — | Help text in secondary color at 0.75rem. Link it with aria-describedby. |
.forma-combobox__indicator | Element class | — | Decorative glyph pinned to the inline end and vertically centered; pointer-transparent. Mark it aria-hidden="true". |
| Keys | Result |
|---|---|
| Typing | Filters the native suggestion list (matching rules are browser-owned). |
| ArrowDown / ArrowUp | Opens and moves through suggestions in browsers that show a datalist popup. |
| Enter | Accepts the highlighted suggestion; with no suggestion open, submits the form natively. |
| Escape | Closes the suggestion popup in most browsers. |
| Limen enhancement | A custom listbox must implement the WAI-ARIA combobox pattern (aria-expanded, aria-activedescendant, Home/End) in application code; Forma provides none of it. |
| Event | Description |
|---|---|
input / change | Native input events. Choosing a datalist suggestion fires input with the new value. Forma adds none. |
A native text input: submits whatever text is present, whether or not it matches a suggestion. List membership must be validated by the application.
| State | How it is expressed | Presentation |
|---|---|---|
| Empty | no value | Label, input and help text; optional placeholder. |
| Suggesting | browser datalist popup | Browser-rendered list of matching suggestions; not styled by Forma. |
| Focus | :focus-visible | Foundation two-tone focus ring on the input. |
| Invalid | aria-invalid="true" plus a linked .forma-validation-message | Error text with a non-color mark below the help text. |
| Loading / no results / error | application-supplied help or status text | Only exists with a Limen enhancement for asynchronous suggestions; express it as text, not only as a spinner. |
Generated fault-injection specimens expose content, spacing, color-cue, and reduced-effective-contrast risks. They screen presentation robustness as engineering screens without claiming human-subject validation.