AGENT SKILL

recursica-skill-autocomplete

Rules for the Recursica autocomplete, a text field that filters a long list of options the persona knows well — a value that must match an option, placeholder rules, a filtered list that is never cut off, and combobox accessibility, including result counts. Use for typeahead fields and fields that search as the persona types. Not for short lists of options — see recursica-skill-dropdown. Not for free text — see recursica-skill-text-field.

License 许可
MIT
最近更新
2026-11-09
Stars
★ 1
Forks
0

01 前言 Front Matter

name
recursica-skill-autocomplete
license
MIT
metadata
{ "author": "hi@borderux.com", "version": "0.2.0" }
description
Rules for the Recursica autocomplete, a text field that filters a long list of options the persona knows well — a value that must match an option, placeholder rules, a filtered list that is never cut off, and combobox accessibility, including result counts. Use for typeahead fields and fields that search as the persona types. Not for short lists of options — see recursica-skill-dropdown. Not for free text — see recursica-skill-text-field.

03 SKILL.md 正文

Autocomplete

An autocomplete is a text field whose value comes from a set list of options. The persona types a few letters, and the field shows only the options that match. The options that match make up the filtered list. The persona then picks an option from the filtered list. For example, the persona types "can" in a Country field and picks "Canada".

When to use an autocomplete

  • Use an autocomplete when the list of options is too long to scan comfortably in a dropdown. Opening a dropdown and reading down the whole list is worse than typing. For example, typing "can" finds Canada faster than scrolling through every country.
  • Use an autocomplete when the persona knows the options well. The persona starts typing a value the persona already has in mind, such as the persona's own country. Typing relies on recall (remembering the answer). Sometimes the persona needs to see the options to recognize the right one. In that case, use a control that shows the options instead.
  • Use an autocomplete when the value must still come from the list of options. The typed text only narrows the list. The typed text is not a free-text entry.

When not to use an autocomplete

Situation Use instead
The list of options is short enough to show all at once Radio buttons, or checkboxes when the persona picks zero to many. See recursica-skill-radio-button and recursica-skill-checkbox.
The list of options is long, but the persona does not know the values well A dropdown, so the persona can read the options instead of recalling the options. See recursica-skill-dropdown.
The value is free-form text that no list could predict, such as a comment A text field. See recursica-skill-text-field.
The list of options holds actions, not values A menu. See recursica-skill-menu.
The value has two options, and each option is the known opposite of the other A switch. See recursica-skill-switch.
The persona viewing the field can never edit the value A read-only field, which shows the label and the text with no input. See recursica-skill-read-only-field.

Do not use a disabled autocomplete to show a value. Sometimes nobody can ever change the value in the place the value is shown. In that case, a disabled autocomplete is not a form control.

Variants

Use only the autocomplete variants and options that the knowledge MCP server lists for the theme (the design a designer sets in Theme Forge: the token values, the components, and each component's variants, states and sizes). A designer can add variants and options in Theme Forge, so each theme can differ. Get the list with the server's component_api tool. The same tool gives the name the code uses for each variant. The name in code can differ from the name in Figma and the UI kit. Use the names in code for every variant and option. A wrong name in code has no effect and shows no error. Never invent a variant or an option.

The rules below describe each option by role, such as "the error state". The names in the standard UI kit (the unchanged UI kit in the official Recursica release) are examples only.

  • The autocomplete has an error state and a disabled state. In the standard UI kit, the state variant is states, with the two options error and disabled.
  • The placeholder is not a variant.
  • Never build a focus state. The autocomplete already shows the focus border.
  • Size. If the theme has a size variant, use the theme's size variant. Otherwise, the autocomplete has a fixed height, the same height as every other single-line field.
  • Multi-select. If the theme has a multi-select variant, or chips that show the chosen values, use the theme's version. Otherwise, see the open questions.
  • Loading. If the theme has a loading state, use the theme's loading state. Otherwise, see the open questions.
  • Icons. A trailing indicator is the icon at the end of the field.
  • Filtered list. If the theme has styles for the filtered list, use the theme's styles.
  • Read-only is a separate component. The read-only field, read-only-field in the UI kit, shows text instead of an input.

Label placement is a variant. A field's label sits beside the field or above the field. In the standard UI kit, the variant is layouts, with the options side-by-side and stacked. The label beside the field is the house default. The label above the field is the fallback when the form's container is too narrow for both side by side. The container's width decides, not the viewport's width. See recursica-skill-forms.

Set label placement explicitly on every field. The house rule puts the label beside the input. The code library under an adapter may put the label above the input by default, at every container width. Set the label beside the input on every field. Use the names the code uses for the variant and the option.

The design-system website shows the autocomplete under the component's former name, "Search". The website's page has two sections that appear only on the website.

Section Options
State Default, Focused, Valued
Behavior Suggestions (optional)

The website's states are not UI kit variants and must not be set as variants. The autocomplete shows the Focused and Valued looks by itself, in response to what the persona does. The website's states do show two parts of the autocomplete:

  • a leading icon
  • a clear control that appears once the field holds text

The website describes Suggestions as an optional extra, not the default.

Rules

Decide whether an autocomplete is the right control from the list of options, not from the field. The length of the list alone does not decide. For a long list, ask how the persona finds the right option:

  • Use a dropdown when the persona recognizes the options on sight.
  • Use an autocomplete when the persona recalls the options from memory, such as the persona's own country.

See recursica-skill-working-memory on recognition versus recall.

Never use an autocomplete for fewer than four options, the dropdown floor. A dropdown is wrong for fewer than four options. An autocomplete is wrong for the same reason. Show a short list of options on the page instead, such as radio buttons or checkboxes.

The value must match an option in the list. Typed text that matches no option is not a value. For example, "Canda" is not a value until the persona picks "Canada". Do not quietly accept typed text that matches no option.

Put the field's rules in the assistive text. The field's rules are:

  • what the field searches, as in "Search by customer name or account number"
  • whether partial matches count
  • any limits

See recursica-skill-assistive-element. Do not put the field's rules in the placeholder. The placeholder disappears on the first keystroke. The placeholder never holds required information.

Set a default value only when the default is correct for nearly everyone. For example, pre-fill a Country field only when nearly every persona picks the same country. Never pre-fill a value the persona would have to think about, look up, or check. A default the persona cannot check gets submitted without being checked.

Label placement is one decision per form, not per field. This field uses the same label placement as every other field in the form. Apply the container-width test once, to the whole form. The result sets the placement of every field in the form. Short fields that would fit side by side follow the result too. A form may change placement at a breakpoint. A form never mixes placements at one breakpoint. A form section never gets a separate placement. recursica-skill-forms sets this rule.

On error, replace the assistive text with the error message. Do not add the error message to the assistive text. The error message must restate the rule the persona broke, as in "Pick a country from the list". The error state must show a signal other than color, such as an icon, in addition to the color change.

The filtered list must not be cut off by the viewport, or by any scrolling ancestor (a container further up the page that scrolls). Check the filtered list near the bottom of the page, inside a panel, and inside a modal.

Never save when the persona selects an option in a form that saves every field together. Every form in the application saves the same way. Either every field saves as soon as the field changes, or every field saves when the persona submits the form.

Choosing an autocomplete option may show more fields. For example, choosing "Canada" in a Country field may show a Province field. Put the new fields right below the autocomplete. Show the new fields immediately. The form still submits every field together.

A disabled autocomplete and a read-only field are different components, not two styles of one component.

  • Disabled autocomplete. Use a disabled autocomplete when the persona could make the field usable by taking a different action first. For example, a City field stays disabled until the persona picks a country. A disabled autocomplete is still a field and still clearly an input. The persona cannot use the disabled autocomplete right now.
  • Read-only field. A read-only field is a different component, with no input. Use a read-only field when the persona viewing the field never changes the value where the value is shown.

An autocomplete that filters a collection of items, instead of setting a form value, saves nothing. A table or a list of records is an example of a collection of items. For example, a customer field above the Orders table narrows the table to one customer's orders. An autocomplete that filters a collection of items does not use the form's save mode. See recursica-skill-filters.

Show the clear control only when the field has a value. Clearing the field empties the field and takes the filter off the collection. The collection then shows every item again. Clearing never empties the text while a filter stays applied.

Choose the placeholder by what the field does and the kind of data the field searches. A generic hint, such as "Search", is fine. Show a format example only when the value must follow that format. The placeholder never replaces the label.

Never make an autocomplete the only way to reach the content the autocomplete searches. A persona who does not know the right word must still be able to reach the content. For example, a persona who forgets an invoice number can still find the invoice by browsing the list of invoices.

Accessibility

The rules below add to the accessibility baseline in recursica-skill-design-system-conventions, which every Recursica component follows.

The filtered list changes on every keystroke. A persona using a screen reader hears none of the changes without an announcement. The autocomplete or a live region announces the changes. Give the autocomplete every piece of information a screen reader needs, such as the result count. Add a live region only for a change the autocomplete does not announce. See recursica-skill-live-regions. Getting the announcements right is the hardest part of any control in the design system.

The autocomplete does four jobs without extra work from the app:

  • links the label to the input
  • shows the focus ring
  • filters the list
  • selects the option the persona picks

Screen readers

  • Give the autocomplete a real label. The label is the accessible name (the name a screen reader reads out for a control). The label must make sense without the text around the field, as in "Country", not "Select one". Never let the placeholder be the accessible name. A screen reader does not announce the placeholder as a label, and the placeholder disappears on the first keystroke.
  • A screen reader must announce the field as a combobox (a text field paired with a list of options), not as a plain text field. The persona has to know that typing shows options, and that the arrow keys move through the options.
  • The code must tell assistive technology whether the filtered list is expanded (open) or collapsed (closed). The persona must hear that the results opened, and hear that the results closed.
  • A screen reader must announce the number of filtered results once the persona pauses typing. Debounce the announcement (wait until the typing stops), and announce politely, as in "2 results" or "no results". Give the autocomplete the count. If the autocomplete does not announce the count, add a live region that does. The result count is the requirement missed most often. A sighted persona watches the list shrink. A persona using a screen reader hears nothing about the change.
  • Announce "no results" clearly. A persona cannot tell silence after typing apart from a broken field.
  • Announce the active option (the option the arrow keys point to) as the persona moves through the list. The announcement includes the option's position in the list and whether the option is selected.
  • Never announce on every keystroke. Announce one count after the typing stops. Too many announcements make the field as unusable as silence does.
  • The selected option must be marked in code, never shown by a highlight or a checkmark alone. recursica-skill-design-system-conventions sets this rule.
  • The chosen value must be readable in the field after the persona selects the value. The chosen value must be announced as the field's value. Never show the chosen value only as visible text that is not the field's value.
  • On error, the error message is the only text announced, because the error message has replaced the assistive text. The error message must state the rule. "Invalid input" is not an error message.
  • Give the trailing indicator no separate announcement. The trailing indicator is part of the field, not a second control.
  • The clear control is a real control and needs a separate accessible name. After clearing, a screen reader must announce that the field is empty. The screen reader must also announce that the full list of options shows again. The leading icon is decorative and must be silent.

Keyboard and non-mouse navigation

  • The clear control is a separate tab stop (a place the Tab key lands). The clear control works with Enter or Space, and never appears only on hover.

  • The field is one tab stop, whether the list is open or closed. Tab must never step through the results. While the list is open, Tab either closes the list or moves past the whole field.

  • Arrow Down and Arrow Up move the active option. Enter selects the active option. Escape closes the list without changing the value and returns focus to the input. Focus must never drop to the top of the page or to the body element.

  • Home and End move the caret in the input. Do not change Home and End to jump to the first or last result. The persona is in a text field and expects Home and End to move the caret within the typed text.

  • The autocomplete handles the keys inside the field without extra code. The built-in key handling includes:

    • which key opens the list
    • wrapping around at the ends of the list
    • any inline completion (the field fills in the remaining letters of a matching option as the persona types)

    Do not add custom code that listens for key presses. Do not rebuild the filtering or the movement through the list.

  • Do not move focus into the list. The input keeps focus and points to the active option. Moving real focus into the list stops the persona from typing and from getting back to the input.

  • Do not move focus for the persona after a selection. Do not jump focus to the next field because the field now has a value. Do not jump focus when the filter narrows the list to exactly one result.

  • Every element and action a mouse can reach must also be reachable by keyboard. Filtering, moving through results, and choosing an option must never depend on a pointer. Nothing the persona needs may appear only on hover.

Styling set by tokens

Never set or override the autocomplete's styling. The theme sets every visual property of the autocomplete, such as size, spacing, borders, colors and animation. Do not add extra containers or spacers to change the autocomplete's look. If the design needs a look the theme does not give, report the missing look as a design-system gap. See recursica-skill-design-router.

Do not set or override the autocomplete's built-in behavior:

  • the connection between the label and the input
  • the filtering and matching
  • the keyboard behavior inside the field

Do not change the space between the label and the field, or the space between fields.

Never style an unfocused field so that the field looks disabled. An editable field must look editable when the persona is not interacting with the field.

Related skills

  • recursica-skill-selection-controls — the selection-control rules:
    • which control a field gets
    • option counts
    • the dropdown affordance test
    • pre-selection
    • disabled versus read-only
    • when a selection is saved
  • recursica-skill-forms — the form rules:
    • single-column layout
    • label placement, and the container width that switches label placement
    • one placement per form
    • required and optional markers
    • when validation runs
    • limits on pre-filled values
    • the form's save mode
  • recursica-skill-label — the label rules:
    • label text that names the object and makes sense without the text around the label
    • the required and optional markers
  • recursica-skill-assistive-element — the assistive-text rules:
    • the help text and error text below the field
    • why the error text replaces the help text instead of joining the help text
  • recursica-skill-working-memory — recognition versus recall, the difference that decides between an autocomplete and a dropdown.
  • recursica-skill-design-system-conventions — never showing meaning in only one way.
  • recursica-skill-live-regions — announcing the result count as the list filters, and when the app must make the announcement.

Only if used on the same screen

  • recursica-skill-dropdown — the control an autocomplete replaces, the four-option floor for a dropdown, and the affordance test.
  • recursica-skill-text-field — the control for free-form values, and the placeholder rules that also apply to an autocomplete.

Open questions

  • When an autocomplete replaces a dropdown. recursica-skill-selection-controls lists the switch from a dropdown to an autocomplete as an open question. The dropdown guidance says only to consider a typeahead when the list is long and the persona knows the values. No count or threshold exists. Confirm with the user.
  • Free text. May the persona submit free text that matches no option? May the persona create a new option from the typed text?
  • How many characters to type. How many characters must the persona type before results appear? Does the full list of options show when the field gets focus with no text typed?
  • Match order. How does the field find and order matches? The question covers matching the start of the text versus any position in the text. The question also covers fuzzy matching, and whether the option highlights the matched characters.
  • No results. What does the field show when no option matches the typed text? Does the field offer a next step?
  • Loading. What does the field show while results are loading? If the theme has a loading, pending, or failed-to-load state, use that state. Otherwise, confirm with the user.
  • Multi-select. If the theme has a multi-select variant, or chips that show the chosen values, use the theme's version. Otherwise, confirm with the user.
  • List details. Are the options in the filtered list grouped, and how?

Pre-flight checklist

  • [ ] The list of options is too long to scan.
  • [ ] The persona knows the values well enough to type one value.
  • [ ] The list has at least four options, the dropdown floor. A short list of options is shown on the page instead.
  • [ ] The submitted value matches an option in the list. Typed text that matches no option is not accepted as a value.
  • [ ] The field has a real label that makes sense without the text around the field. The placeholder is not used as the label.
  • [ ] Label placement is side by side, unless the container is too narrow.
  • [ ] Label placement matches every other field in the same form. Each form has one placement at each breakpoint, with no mixing between fields or form sections.
  • [ ] No required information is in the placeholder. The field's rules are in the assistive text.
  • [ ] Any default is correct for nearly everyone.
  • [ ] On error, an error message that restates the rule replaces the assistive text, with a signal that is not color.
  • [ ] The filtered list is not cut off by the viewport, a panel, a modal, or any scrolling ancestor.
  • [ ] A screen reader announces the expanded state, and the filtered result count once the typing stops. The screen reader also announces "no results", the active option, and the chosen value. The screen reader gets no more announcements than the persona needs.
  • [ ] The field is one tab stop. The arrow keys move the active option, Enter selects, and Escape closes the list and returns focus to the input.
  • [ ] Home and End still move the caret in the input.
  • [ ] The autocomplete's built-in key handling and filtering are unchanged, and real focus never moves into the list.
  • [ ] Focus is never moved for the persona, including when the filter narrows the list to one result.
  • [ ] Nothing the persona needs requires hover or a pointer. The focus ring is intact, and looks different from the active option style and the selected option style.
  • [ ] Disabled is used only for fields that are unavailable for now. Values that can never be edited use the read-only field.
  • [ ] Every variant, size, and state is one the theme's UI kit lists. The built-in connection between the label and the input is unchanged. The space between the label and the field, and the space between fields, are unchanged. Every field without focus looks editable, not disabled.
  • [ ] No styling is set or overridden on the autocomplete.
  • [ ] No container or spacer is added to change the autocomplete's look.
  • [ ] The field saves with the form, in the same save mode as every other field in the application.
  • [ ] Open questions were asked about, not decided: the replacement threshold, free text, how many characters to type, match order, no results, loading, multi-select, and list details.

04 同仓库更多 Skills

borderux
borderux/recursica-knowledge

recursica-skill-template

Replace with a description of the skill and its purpose.

★ 1
borderux
borderux/recursica-knowledge

recursica-skill-working-memory

The research behind Recursica's item-count limits, with citations — Miller's 7 ± 2, Cowan's 4, chunking, and recognition versus recall. Use when a decision turns on how many options, navigation items, or chips to show at once, or to justify or challenge a count. Not for choosing a control — see recursica-skill-selection-controls.

★ 1
borderux
borderux/recursica-knowledge

recursica-skill-discoverability

The research behind Recursica's rule that rarely needed settings get a real but unpromoted entry point — the paradox of the active user, satisficing (settling for the first method that is good enough), and progressive disclosure, with citations. Use when deciding whether to hide, promote, or build a configuration or customization feature, or to justify that choice. Not for item counts — see recursica-skill-working-memory.

★ 1
borderux
borderux/recursica-knowledge

recursica-skill-design-router

Start here for any Recursica screen work. The router says what to decide in what order, which skill owns each decision, which rule wins when two rules conflict, and when to confirm with the user instead of guessing. Load the router first to design, build, review, or refactor a screen, page, panel, or flow, or when rules seem to disagree or no rule applies. The router routes, and the owning skill holds the rules.

★ 1
borderux
borderux/recursica-knowledge

recursica-skill-undo

House rules for undo — when an action gets an undo instead of a confirmation, where the undo goes (on the page, in place, or in a toast), when a toast is needed at all, and the Undo button's accessible name. Use whenever an action can be reversed, or when choosing between an undo and a confirmation. Not for building the toast that holds an Undo button — see recursica-skill-toast. Not for the confirmation modal — see recursica-skill-buttons-links.

★ 1
borderux
borderux/recursica-knowledge

recursica-skill-typography-semantics

House rules for type and semantic markup — real elements instead of styled divs, one H1 per page, type styles from tokens only, loading the brand typefaces, hidden headings, emphasis with em and strong, abbreviations, and AP style. Use for headings, body copy, emphasis, and the markup under a visual hierarchy. Not for naming — see recursica-skill-names-and-terms.

★ 1