Stay Search
The search that starts a stay: where to, check-in to check-out, Search. One bar on a desk, a stacked card on a phone.
Preview
Usage
import { StaySearch } from "zostel-ui";
<StaySearch
suggestions={[{ value: "manali", label: "Manali", category: "Places" }, …]}
from={from}
to={to}
onDatesChange={({ from, to }) => setDates({ from, to })}
disabledDays={{ before: today }}
onSearch={({ place, text, from, to }) => go(place?.value ?? text, from, to)}
note="111 Zostels in 80+ destinations."
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
suggestions | { value; label; category? }[] | — | What “Where to?” suggests as you type, grouped by category (places, stays, trips). |
from / to | Date | — | The stay’s dates (controlled). |
onDatesChange | ({ from, to }) => void | — | Called on every pick in the calendar. |
onSearch | ({ place?, text, from?, to? }) => void | — | Called on Search, and on Enter in “Where to?” when no suggestion is highlighted: the suggestion picked (if any), what was typed, the dates. |
disabledDays | Matcher | Matcher[] | — | Days that can’t be booked, e.g. { before: today }. |
placeholder | string | "Search a place, a stay or a trip" | “Where to?”’s hint. |
note | ReactNode | — | A line on the Beige strip under the bar. |
searchLabel | string | "Search" | The button’s word. |
className | string | — | More classes, merged with the component’s own (tailwind-merge). |
suggestions{ value; label; category? }[]What “Where to?” suggests as you type, grouped by category (places, stays, trips).
from / toDateThe stay’s dates (controlled).
onDatesChange({ from, to }) => voidCalled on every pick in the calendar.
onSearch({ place?, text, from?, to? }) => voidCalled on Search, and on Enter in “Where to?” when no suggestion is highlighted: the suggestion picked (if any), what was typed, the dates.
disabledDaysMatcher | Matcher[]Days that can’t be booked, e.g. { before: today }.
placeholderstring"Search a place, a stay or a trip"“Where to?”’s hint.
noteReactNodeA line on the Beige strip under the bar.
searchLabelstring"Search"The button’s word.
classNamestringMore classes, merged with the component’s own (tailwind-merge).
On zostel.com
The home page’s first screen. “Where to?” is the kit’s SearchBar in its bare look (type, the arrow keys, Enter), the dates are the DateRangePicker in its split look (a sheet on a phone), and the bar is a form with role="search", so Enter searches from anywhere in it.