Skip to content
Viewership Inquire
Astro UI

Search.

Command search with live filtering and an empty state.

NavigationComponent1 dependency Beautiful UI, MIT

.md

Install

  1. Import the foundation once

    foundation.css holds the tokens every component reads.

    Layout.astro
    ---
    // src/layouts/Layout.astro
    import "../styles/foundation.css";
    ---
  2. Copy SearchList.astro

    Paste into src/components/viewership/search/

  3. Copy its dependencies

    Each in its own folder, next to this one.

  4. Use it

    Page.astro
    ---
    import SearchList from "../components/viewership/search/SearchList.astro";
    ---
    
    <SearchList />

Props 4

PropTypeDefaultDescription
items string[] · Items. Case-insensitive substring match.
limit number 5 Suggestions shown for an empty query.
value string "" Initial query. Works without JS.
labels Partial<SearchListLabels> · placeholder, ariaLabel, listLabel, emptyTitle, emptyHint, clear, results ("{n} results"), oneResult.

Events

EventDetailWhen
vs-search-select CustomEvent<{ value: string; index: number }> Fires on pick. index points into items.
vs-search-input CustomEvent<{ query: string; count: number }> Fires on each query change.

Source 1 file

Ported from Beautiful UI, MIT. Notices.