Search field
A search field lets users find specific content or information by entering free-text queries.
Usable — may still change
The Search Field is a flexible input component that lets users find specific content or information by entering free-text queries. It is a primary navigation and discovery tool, helping users bypass complex menu structures to find exact items, categories, or data points quickly. By supporting various states (collapsed, expanded) and brand-specific configurations (Toyota, Lexus), it ensures a consistent search experience across the entire ecosystem.
Anatomy
Section titled “Anatomy”- Search field
- Leading icon
- Input
- Clear
- Trailing icon
- Slot
When to use it
Section titled “When to use it”Use a search field when:
- Discovery is the goal. Users need to find information within a large, diverse, or unknown dataset (for example help articles, product catalogs, or global site search).
- The input is open-ended. Users may type keywords, phrases, or specific IDs rather than selecting from a list.
- The content is large or dynamic. The results are too numerous to be predefined or displayed in a simple list.
Use a searchable dropdown instead when:
- Selection is required. The user must pick a specific, valid value from a fixed, closed list (for example a country or currency).
- Data integrity matters. You need to prevent users from entering custom text that doesn’t match your database.
- The list is finite. The options are predefined, even if the list is long enough to require a filter.
Search field vs searchable dropdown vs dropdown
Section titled “Search field vs searchable dropdown vs dropdown”Search field
Use a search field when users need to find something in a large or unknown set of content.
What it is: a free-text input where users can type anything (keywords, phrases, IDs).
What happens: it shows results, filters content, or takes users directly to what they are looking for.
Use it when:
- The list of possible results is very large or not predefined.
- Users may not know the exact name of what they are searching for.
- The goal is discovery or navigation (for example products, files, help articles).
Searchable dropdown
Use a searchable dropdown when users must choose from a fixed list of options.
What it is: a dropdown with a built-in search to filter long lists.
What happens: users select one value from a predefined set.
Use it when:
- The options are known and limited to a closed list.
- Accuracy is important (users must pick a valid option).
- The list is long enough to need filtering (for example countries, departments, currencies).
Must the user select from a predefined, closed list?
If no, use a search field.
Are there more than 7–10 options in that list?
If no, use a dropdown or radio buttons.
Does the user know the name of what they are looking for beforehand?
If yes, use a searchable dropdown. If no, use a categorized dropdown or a modal or picker.
Properties
Section titled “Properties”Expansion
Toggle between Collapsed (icon only) and Expanded (full input).
Type
Contained has a background container. Divided has only a bottom divider.
Size
Small (44 px) and Large (56 px).
Scheme
Available in Neutral and Contrast to ensure accessibility across different backgrounds.
Icons
To meet the specific visual standards of Toyota and Lexus, the search icon and secondary elements are fully customizable. The search icon can be placed on either the left (Toyota) or the right (Lexus). Lexus also supports a decorative icon on the left and a functional search icon on the right at the same time.
Clear
A clear (✕) icon button lets users clear their query once they start typing.
Slots
The component includes dedicated slots, allowing designers and developers to inject custom elements to meet specific functional needs beyond the standard configuration.
Text overflow
The text is limited to a single line. It must not wrap or increase the height of the component. An ellipsis shows that text continues beyond the visible area, and the clear button stays fixed on the right.
How to use slots
Section titled “How to use slots”- Select the component. Click on the component instance in your canvas that contains a slot.
- Access the slot property. Navigate to the Properties section in the right-hand panel. Find the Slot List property and click the + (plus) icon.
- Choose a replacement. After clicking the plus icon, the panel view will change. Click the + again to open a dropdown menu featuring Recommended Components.
- Swap the content. Select your desired component from the list to inject it into the slot.
- Refine and duplicate. Once the new component is inside the slot, you can duplicate it (if needed) and modify its specific properties directly from the panel.
Best practices
Section titled “Best practices”Do
Provide a clear placeholder (for example “Search for a model…”) to give users a hint of what they can find. Allow users to clear their query quickly using a clear (✕) icon button once they start typing.
Don't
Don’t use a search field if there are fewer than 7–10 items to choose from; a standard selection component is better. Don’t make the search field too short; ensure it is wide enough to display typical search queries without cutting off text.
A search field is a role="search" container wrapping a native <input type="search">, a decorative leading icon, and any trailing controls. The states are keyed off the DOM — :hover, focus, whether the input holds a value, and whether it’s disabled — so no state classes to toggle and no JavaScript needed for the styling.
Give the input a placeholder and an accessible name.
<form class="tng-search-field" role="search"> <i class="tng-icon icon-search tng-search-field-icon" aria-hidden="true" ></i> <input class="tng-search-field-input" type="search" placeholder="Search for a model" aria-label="Search for a model" /> <button class="tng-search-field-button" type="submit" aria-label="Search" > <i class="tng-icon icon-search" aria-hidden="true"></i> </button></form>Elements
Section titled “Elements”Placeholder
Section titled “Placeholder”The input needs a placeholder — it isn’t only copy. The filled styling is selected with :placeholder-shown, so without one the field renders in its filled state while empty. Pair the input with a visible <label>, or give it an aria-label as above.
Leading icon
Section titled “Leading icon”.tng-search-field-icon is decorative. Mark it aria-hidden="true" — the input’s own label carries the accessible name. Being the first child is what makes it take the leading foreground colour, so any icon works here.
Trailing controls
Section titled “Trailing controls”.tng-search-field-button is any interactive control after the input — clear, submit, or the collapsed trigger. Each is a bare 20 px icon that picks up a 44 px touch target from the shared touch-target utility, so it clears the WCAG minimum without changing the layout.
Long queries
Section titled “Long queries”The query stays on one line. Text past the edge ends in an ellipsis while the input isn’t focused, and the trailing controls stay put.
The search icon goes on either side. To show a second icon on Lexus, put a decorative icon first and the search button last. The first child takes the leading colour, whichever icon it holds.
<form class="tng-search-field is-contained" role="search"> <i class="tng-icon icon-ai-sparkle tng-search-field-icon" aria-hidden="true" ></i> <input class="tng-search-field-input" type="search" placeholder="Search" aria-label="Search" /> <button class="tng-search-field-button" type="submit" aria-label="Search" > <i class="tng-icon icon-search" aria-hidden="true"></i> </button></form>Variants
Section titled “Variants”is-contained draws a full bordered box with its own fill; the default (is-divided, which you can also write explicitly) draws only a rule under the content. On Lexus, contained rounds to a pill and its copper border is a gradient.
<form class="tng-search-field is-divided" role="search"> <i class="tng-icon icon-search tng-search-field-icon" aria-hidden="true" ></i> <input class="tng-search-field-input" type="search" placeholder="Divided" aria-label="Divided" /></form><form class="tng-search-field is-contained" role="search"> <i class="tng-icon icon-search tng-search-field-icon" aria-hidden="true" ></i> <input class="tng-search-field-input" type="search" placeholder="Contained" aria-label="Contained" /></form>Add the clear button once the user starts typing. hidden hides it until then.
<form class="tng-search-field is-contained" role="search"> <i class="tng-icon icon-search tng-search-field-icon" aria-hidden="true" ></i> <input class="tng-search-field-input" type="search" placeholder="Search for a model" aria-label="Search for a model" value="Privacy glass" /> <button class="tng-search-field-button" type="button" aria-label="Clear search" > <i class="tng-icon icon-close" aria-hidden="true"></i> </button> <button class="tng-search-field-button" type="submit" aria-label="Search" > <i class="tng-icon icon-search" aria-hidden="true"></i> </button></form>Collapsed
Section titled “Collapsed”is-collapsed reduces the field to an icon-only square and hides everything after the first child, so the same markup collapses and expands by toggling one class, and the field slides between the two. It opens to the full width of its container; set --tng-search-field-max-inline-size to stop it earlier. The trigger owns aria-expanded. See the Recipe below for the focus management this needs.
<div class="tng-search-field is-contained is-collapsed"> <button class="tng-search-field-button" type="button" aria-expanded="false" aria-label="Open search" > <i class="tng-icon icon-search" aria-hidden="true"></i> </button> <input class="tng-search-field-input" type="search" placeholder="Search for a model" aria-label="Search for a model" /></div>Two sizes set the height, horizontal padding and type: is-sm (default, 44 px, body 7) and is-lg (56 px, body 6, or body 5 on Lexus).
<form class="tng-search-field is-contained is-sm" role="search"> <i class="tng-icon icon-search tng-search-field-icon" aria-hidden="true" ></i> <input class="tng-search-field-input" type="search" placeholder="Small" aria-label="Small" /></form><form class="tng-search-field is-contained is-lg" role="search"> <i class="tng-icon icon-search tng-search-field-icon" aria-hidden="true" ></i> <input class="tng-search-field-input" type="search" placeholder="Large" aria-label="Large" /></form>States
Section titled “States”Disabled
Section titled “Disabled”Disable the input — the whole field follows. The styling deliberately keys off .tng-search-field-input:disabled rather than any disabled descendant, so disabling the clear button while the query is empty doesn’t dim the entire control.
<form class="tng-search-field is-contained" role="search"> <i class="tng-icon icon-search tng-search-field-icon" aria-hidden="true" ></i> <input class="tng-search-field-input" type="search" placeholder="Search unavailable" aria-label="Search unavailable" disabled /></form>Recipes
Section titled “Recipes”Expand, collapse, clear and suggest
Section titled “Expand, collapse, clear and suggest”The field slides open and takes focus, the clear button appears once there’s a query, and the slot shows content while typing. Escape clears the text, then collapses the field. The List in the slot is only an example, with sample data.
The search field targets WCAG 2.1 AA and is exposed as a search landmark.
For designers
Section titled “For designers”- While placeholders are helpful, ensure the search context is clear. Use an
aria-labelif a visible label is not used in the layout. Source: WCAG 3.3.2 Labels or Instructions. - Never remove or obscure the blue focus ring; it is essential for users navigating via keyboard. Source: WCAG 2.4.7 Focus Visible.
- Ensure the text inside the input meets a 4.5:1 contrast ratio against the background, in both contained and divided. Source: WCAG 1.4.3 Contrast (Minimum).
For developers
Section titled “For developers”Use role="search" for the surrounding container, and aria-expanded="true|false" on the collapsed variant’s trigger. There are no keyboard traps: users must always be able to move focus away using Tab or Shift + Tab. Source: WCAG 2.1.2 No Keyboard Trap.
The interactive area must be at least 44 px in height to support touch accessibility. The large variants provide a minimum interaction area of 44 px, optimizing the experience for touch devices and improving targets for users with limited motor skills. Source: WCAG 2.5.8 Target Size (Minimum).
Keyboard interaction
Section titled “Keyboard interaction”| Key | Action |
|---|---|
| Tab | Move focus into and out of the search field |
| Enter / Space | Trigger the search, when the search icon functions as a button |
| Escape | When expanded or showing suggestions, collapse the field or clear the text |
Focus order
Section titled “Focus order”The input, then the clear button, then each item in the slot. Collapsed, the search icon is the only stop, and Space or Enter activates it.
- 1 — Input
- 2 — Clear
- 3 — Suggestion
- 4 — Suggestion
- 5 — Suggestion
Source: WCAG 2.4.3 Focus Order.
Slot content
Section titled “Slot content”Figma leaves the slot open, and the list in its samples is only an example. Whatever it holds belongs to the search, so the landmark goes around both the field and the slot: a <search> element or a role="search" wrapper, rather than role="search" on the field. Name the landmark, and keep each item focusable so it takes Tab.
<search aria-label="Models"> <form class="tng-search-field"> <i class="tng-icon icon-search tng-search-field-icon" aria-hidden="true" ></i> <input class="tng-search-field-input" type="search" placeholder="Search for a model" aria-label="Search for a model" value="Cor" /> <button class="tng-search-field-button" type="button" aria-label="Clear search" > <i class="tng-icon icon-close" aria-hidden="true"></i> </button> </form> <ul class="tng-list tng-has-dividers" aria-label="Suggestions"> <li class="tng-list-option"> <a href="#slot-content">Corolla</a> </li> <li class="tng-list-option"> <a href="#slot-content">Corolla Cross</a> </li> </ul></search>Labelling elements
Section titled “Labelling elements”Search field
role="search" on the surrounding container.
Input
A visible label, or an aria-label if the layout has none. Truncating the text doesn’t affect how screen readers announce it.
Collapsed trigger
aria-expanded="true|false".
Source: WCAG 4.1.2 Name, Role, Value.