iOS search field

A 48px search capsule with a native input and a separate clear action.

Find a note

Studio measurements
Braun reference
Weekend route

3 notes

Use it for

  • Search within a list, app or document.
  • Use onValueChange to respond to both typing and the clear button.

Not for

  • Treating a placeholder as the only accessible label.
  • A noneditable search launcher; use a button.

Three ways in. They share one source, so the pixels match whichever you pick.

1. Import the package

npm install @noorddev/vlak-react

// once, next to your app's root
import "@noorddev/vlak-react/css";

import { IOSSearchField } from "@noorddev/vlak-react";

Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/ios-search-field.

2. Vendor the source

npx @noorddev/vlak-cli add ios-search-field

The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.

3. Through shadcn

npx shadcn add https://vlak.dev/r/ios-search-field.json

The same registry item, installed by shadcn's CLI.

CSS only

<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />

No React. Link vlak.css and use the markup and classes below.

import { IOSSearchField } from "@noorddev/vlak-react";

<IOSSearchField name="q" aria-label="Search notes" placeholder="Search" onValueChange={query => console.log(query)} />

IOSSearchField

A 48px search capsule with a native input and an explicit clear target.

PropTypeDefaultDescription
valuestring
defaultValuestring""
onValueChange(value: string) => voidFires when typing or using the clear action.
clearLabelstring"Clear search"

Also accepts Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "children">.

KeysDoes
Tab, Shift+TabMoves between the native search input and the clear button when text is present.
Enter, Space on ClearClears the text and returns focus to the input.
Enter in the inputUses the enclosing form’s native submit behavior.
<div class="rs-ios-search-field"><input class="rs-ios-search-field-input" type="search" aria-label="Search notes" placeholder="Search" /></div>
.rs-ios-search-field.rs-ios-search-field-disabled.rs-ios-search-field-symbol.rs-ios-search-field-input.rs-ios-search-field-clear