Skip to content

docs(useCollator): add a minimal live example #9475

Closed

Description

@cixzhang

What: useCollator — Returns the locale-aware comparator to use for custom sorting; it is recreated when the provider locale or an option changes.

A good example shows: A Table of people whose Name column holds names with accents and mixed case (for example "Émile", "emma", "Zoë", "Ana"). Clicking the column header sorts it with the collator's compare function, so accented and lowercase names land where a reader expects, ignoring case. A locale switch (for example English vs Swedish) shows the order change.

Where:

Acceptance criteria:

  • A template block names useCollator in exampleFor (or alsoExampleFor) and renders in the Examples section of the hook's docsite page.

  • The hook visibly drives the behavior: removing the hook call breaks what the example shows. Minimal code; no unrelated UI or styling.

  • Meets the rule architecture:knowledge-contracts INV28 (docs/architecture/knowledge-contracts.md), quoted here:

    INV28 — Every public hook has a minimal, runnable example that
    demonstrates it.
    A public hook is a hook that a package's committed API
    report lists. Its documentation includes at least one realistic, runnable
    example: a live template block that names the hook as its example target
    (exampleFor, or alsoExampleFor when the block also serves another page).
    The example:

    • shows the hook inside a component solving the use case its docs state;
    • imports the package's own code only through its public entry points;
    • covers the hook's main parameters and return values;
    • passes the docs build;
    • gets its visible behavior from the hook itself, so removing the hook breaks
      what the example shows; and
    • is minimal: only the code needed to show the use case, with no unrelated UI
      or styling.

    How a docs page selects and orders its example blocks belongs to
    architecture:template-authoring. A public hook without a conforming example
    is a docs gap, tracked as an issue in the repository's issue queue (DEC-16).

Good first issue: start with CONTRIBUTING.md. For orientation, run astryx docs and astryx component --list from the repo root (the CLI is node packages/cli/clients/cli/bin/astryx.mjs). The hook's own tests next to its source show how it is called.

Filed by an AI agent on behalf of the maintainer, as part of a docs-coverage sweep.

Activity

  1. added
    documentation
    good first issue
    on Nov 2, 2026
  2. added a commit that references this issue on Nov 2, 2026
    a34b886
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions