"use client";
import { ResultsAnnouncer } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
count (required) | number | null | undefined | — | Current number of results; null/undefined announces nothing. |
formatMessage | (count: number) => string | the catalog's "{count} results" / "No results" | Text for a count (default: the catalog's "{count} results" / "No results"), e.g. (count) => \${count} sounds\``. |
trigger | unknown | — | Any value whose change re-announces the same message, e.g. the query: typing "air" then "airh" with 7 results both times says "7 results" again. |
announceInitial | boolean | false | Announce the first message too (default false: only changes after mount, so a page that renders a list does not talk on load). |
delay | number | 500 | Wait this long (ms) for the message to settle (default 500). |
politeness | "assertive" | "polite" | polite | polite (default) or assertive. |
countrequirednumber | null | undefined
Current number of results; null/undefined announces nothing.
formatMessagedefault the catalog's "{count} results" / "No results"(count: number) => string
Text for a count (default: the catalog's "{count} results" / "No results"), e.g. (count) => \${count} sounds\``.
triggerunknown
Any value whose change re-announces the same message, e.g. the query: typing "air" then "airh" with 7 results both times says "7 results" again.
announceInitialdefault falseboolean
Announce the first message too (default false: only changes after mount, so a page that renders a list does not talk on load).
delaydefault 500number
Wait this long (ms) for the message to settle (default 500).
politenessdefault polite"assertive" | "polite"
polite (default) or assertive.
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
const query = "kick";
const results = ["kick", "kick-2"];
<ResultsAnnouncer count={results.length} trigger={query} formatMessage={(count) => `${count} sounds`} />