foontofoonto

Component

Search Bar

A search field that grows from an icon button to full width.

How to use

Minimal, copy-pasteable code.

Header.tsx
import { useState } from "react";
import { SearchBar } from "react-native-foonto";

export function Header() {
  const [query, setQuery] = useState("");

  return (
    <SearchBar
      value={query}
      onChangeText={setQuery}
      placeholder="Search…"
      onSubmit={(q) => console.log(q)}
    />
  );
}

Props

PropTypeDefaultDescription
valuereqstringControlled query text.
onChangeTextreq(text: string) => voidCalled as the query changes.
placeholderstringPlaceholder shown when expanded.
onSubmit(text: string) => voidCalled when the user submits.
collapsedSizenumber48Diameter of the collapsed icon button.
durationnumber280Expand/collapse duration in ms.
tintstring'#6d28d9'Accent color for the icon + caret.
backgroundstring'#f4f4f5'Background of the bar.
textColorstring'#18181b'Input text color.
placeholderColorstring'#a1a1aa'Placeholder text color.
clearOnCollapsebooleantrueClear the query when collapsing.
renderIcon(color) => ReactNodeCustom leading icon (e.g. a Tabler icon).
renderClearIcon() => ReactNodeCustom clear icon.
styleFoontoStyleStyle for the wrapper.

AI prompt

Install the library, then paste this into your AI coding agent to wire it up.

AI prompt
Add an expanding search bar using the `react-native-foonto` library.

1. Make sure `react-native-foonto` and `react-native-reanimated` are installed.
2. Import `SearchBar` from `react-native-foonto`.
3. Keep the query in `useState` and pass `value` + `onChangeText`.
4. Filter your list from the query and handle `onSubmit` for the keyboard's search key.
5. To match your icon set, pass `renderIcon` / `renderClearIcon` (e.g. Tabler or your own SVGs).