Search input component in Observable Framework — filter tabular data.
Observable Framework documentation: Input: Search Source: https://observablehq.com/framework/input-search
<a href="https://github.com/observablehq/inputs/blob/main/README.md#search">API</a> · <a href="https://github.com/observablehq/inputs/blob/main/src/search.js">Source</a> · The search input allows freeform, full-text search of a tabular dataset (or a single column of values) using a simple query parser. It is often paired with a table input.
By default, the query is split into terms separated by spaces; each term is then prefix-matched against the property values (the fields) of each row in the data. Try searching for “gen” below to find Gentoo penguins.
const searchInput = Inputs.search(penguins, {placeholder: "Search penguins…"});
const search = view(searchInput);
const search = view(Inputs.search(penguins, {placeholder: "Search penguins…"}));
search
Or, as a table:
Inputs.table(search)
for (const abbr of document.querySelectorAll("abbr")) {
abbr.title = `Search for “${abbr.textContent}”`;
abbr.style.cursor = "default";
abbr.onclick = () => {
const input = searchInput.querySelector("input");
input.value = abbr.textContent;
input.dispatchEvent(new Event("input", {bubbles: true}));
};
}
If you search for multiple terms, such as “<abbr>gen bis</abbr>” (for Gentoos on the Biscoe Islands) or “<abbr>gen fem</abbr>” (for female Gentoos), every term must match: there’s an implicit logical AND.
If you’d like different search syntax or behavior, pass the filter option. This function is passed the current search query and returns the filter test function to be applied to the data.
Inputs.search(data, options)
The available search input options are:
If a filter function is specified, it is invoked whenever the query changes; the function it returns is then passed each element from data, along with its zero-based index, and should return a truthy value if the given element matches the query. The default filter splits the current query into space-separated tokens and checks that each token matches the beginning of at least one string in the data’s columns, case-insensitive. For example, the query [hello world] will match the string “Worldwide Hello Services” but not “hello”.
npx skills add spqw/Observable Framework 输入 — 搜索下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer