Skip to content

8.8. Tag Autocomplete & SearchableState

The note form's tag suggestions are the smallest high-signal example of SearchableState<T> in the flagship portfolio.

8.8.1. Scenario Use

  • the workspace maintains the available tag set
  • NoteFormVM composes SearchableState<string> over that tag list
  • the tag-list mutation signal is supplied to SearchableState, so additions, removals, replacements, and resets refresh suggestions without changing the user's current term
  • the host adapter binds the filtered suggestions without moving search state into the view

8.8.2. Why It Matters

This example complements the broader notes-list filtering story. The notes list uses SearchableState over note VMs; tag autocomplete shows the same helper on a lightweight string collection.

If suggestions also depend on mutable state inside tag viewmodels, map an AggregateChangeStream to the search source signal. The aggregate owns dynamic member observation; search owns only its subscription to the resulting pulse.

8.8.3. Where It Lives

  • C#: examples/csharp/avalonia/NotesShowcase/ViewModels/NoteFormVM.cs, member _tagSearch
  • Python: examples/python/textual/notes_showcase/src/notes_showcase/viewmodels/note_form_vm.py, member _tag_search
  • TypeScript: examples/typescript/react/notes-showcase/src/viewmodels/noteFormVM.ts, member #tagSearch
  • Swift: examples/swift/notes-showcase/Sources/NotesShowcaseCore/ViewModels/NoteFormVM.swift, member _tagSearch

8.8.4. Where To Verify

  • Primitive guide: State & Reactive Helpers
  • Parity matrix, which links each flavor README: examples/notes-showcase-parity.md