SearchField

SearchField collects one native search query with accessible clear, deliberate Enter events, and consumer-owned results.

Overview and decision boundary

Use SearchField for one free-form query that needs accessible clear and explicit Enter search behavior.

Do not add results, suggestions, requests, debounce, filtering, ranking, routing, global shortcuts, history, analytics, or product entities.

Submit one query; results and requests stay in the product.

Searching activity
import { SearchField } from '@nerio-ui/ui/client';<SearchField  label="Search projects"  name="query"  autoComplete="off"  onSearch={(query) => runSearch(query)}/>

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm exec nerio add search-fieldimport { SearchField } from '@nerio-ui/ui/client';

Usage

import { SearchField } from '@nerio-ui/ui/client';<SearchField  label="Search projects"  name="query"  autoComplete="off"  onSearch={(query) => runSearch(query)}/>

Variants

VariantPurpose
smCompact size for dense layouts and inline use.
mdDefault size for most product surfaces.
lgLarger size for prominent local actions.
LTRLTR is part of the public component contract.
RTLRTL is part of the public component contract.

Anatomy

SlotPurpose
root / labelField root and visible native label.
input-group / inputShared surface around one native search input.
search-iconDecorative default or consumer-provided search icon.
actions / clearLocalizable clear action that restores input focus.
loadingLocalizable default status or consumer loading-indicator slot.
description / messageAssociated help or validation content.

States

StateBehavior
ValueOne controlled or uncontrolled string query.
SearchEnter emits onSearch without preventing native form submission.
LoadingPresentation only; requests remain consumer-owned.
Disabled / read-onlyPreserves native semantics and prevents clearing.
Required / invalidParticipates in forms and associates validation content.

Motion

  • shared form-control transitions
  • reduced-motion immediate transition

Accessibility

  • Uses a native input type=search associated with a visible Field label, description, and message.
  • Supports one controlled or uncontrolled string value without mirrored state; native form identity and reset remain intact.
  • The localizable clear action is a native button, is unavailable while disabled or read-only, and restores focus to the same input node.
  • Enter emits one Nerio-owned search event without preventing native form submission; IME composition is not treated as a search.
  • The search icon is decorative. The default loading indicator exposes a localizable status through loadingLabel; a custom loadingIndicator must provide equivalent semantics.
  • Disabled, read-only, required, invalid, autofill, LTR, RTL, narrow-container, and long-label behavior preserve the shared form contracts.
  • Results, suggestions, requests, debounce, filtering, ranking, routing, global shortcuts, history, analytics, and product search workflows remain consumer or Pro responsibilities.

Review the shared responsibility and evidence boundaries in the Accessibility foundation alongside this component-specific contract. Use the Spacing & layout foundation for shared density, wrapping, overflow, reflow, and component-versus-product ownership guidance. The Color foundation, Typography foundation, and Localization foundation define the shared visual-role, text-resilience, direction, and locale boundaries used by component examples.

API

PropsPurpose
value / defaultValue / onValueChangeOne controlled or uncontrolled query.
onSearchReceives the current query and an IME-safe Enter event detail.
clearLabelLocalizable accessible name for the icon-only clear action.
loading / loadingLabelDefault localizable loading status presentation.
searchIcon / loadingIndicatorMeaningful structural customization slots.
name / form / required / autoCompleteNative form identity, reset, and autofill hints.
disabled / readOnly / invalidNative interaction and Field validation states.

Implementation contract

ContractValue
Registry itemsearch-field installs 3 source files into the configured components directory.
Base UINo interactive primitive required.
Registry dependenciesbutton, field, input-group, spinner
Package dependencies@nerio-ui/adapters, @base-ui/react, clsx, react, tailwind-merge, tailwindcss

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Use SearchField for one free-form query that needs accessible clear and explicit Enter search behavior.

Do / do not

Do
Use SearchField for one free-form query that needs clear and explicit search behavior.
Do not
Put results, requests, debounce, filtering, ranking, routing, global shortcuts, history, analytics, or product entities in SearchField.

Tokens

These are the primary customization points. Override semantic or component tokens instead of changing component source.

TokenPurpose
--n-input-height-smPublic customization point for this component contract.
--n-input-height-mdPublic customization point for this component contract.
--n-input-height-lgPublic customization point for this component contract.
--n-input-radiusPublic customization point for this component contract.
--n-input-backgroundPublic customization point for this component contract.
--n-input-background-hoverPublic customization point for this component contract.
--n-input-borderPublic customization point for this component contract.
--n-input-border-hoverPublic customization point for this component contract.
--n-input-border-focusPublic customization point for this component contract.
--n-input-border-dangerPublic customization point for this component contract.
--n-input-placeholderPublic customization point for this component contract.
--n-input-foregroundPublic customization point for this component contract.
--n-input-disabled-backgroundPublic customization point for this component contract.
--n-input-disabled-foregroundPublic customization point for this component contract.
--n-input-addon-foregroundPublic customization point for this component contract.
--n-input-addon-gapPublic customization point for this component contract.
--n-input-addon-padding-inlinePublic customization point for this component contract.
--n-focus-ringPublic customization point for this component contract.