{"version":"v1.0","client_state":{"DocsNavigation.default":{"fields":{"query":""},"persist":"memory","send_to_server":true},"ColorScheme.default":{"fields":{"mode":"system"},"persist":"local","send_to_server":true},"EchoClient.default":{"fields":{"text":""},"persist":"local","send_to_server":true},"DocsInspector.default":{"fields":{"show_html":false},"persist":"local","send_to_server":true}},"endpoints":{"action":"/_bretzel/action","sse":"/_bretzel/sse","refetch":"/_bretzel/refetch"},"csrf":"399035c337fd5aae4c763baa062ee271","page_id":"213f7975f7824ac69bf850170de377ed","address":""}

Client state

A client state lives in the browser — the runtime reflects it, without ever touching the server. It is the right choice for pure UI: a panel open or closed, a display filter, a local preference.

Declaring, and persistence

One inherits from `ClientState`. `persist=` decides one thing only: how long the value survives.
class FilterUI(ClientState, persist="local"):
    sort_by: str = "date"
persist=SurvivesWhat for
"memory" (default)throwaway — lost on reload (F5) and on closea UI flag (menu open)
"session"survives a reload, lost on closea filter, a wizard step
"local"survives everythinga real preference (theme, sort)

Demo — the client mirror, zero round trips

The input writes into a ClientState; the text below reflects it through `bz-text`. No network — the runtime swaps the text on every keystroke.
Live echo:
See the emitted HTML

Summary

EchoClientClientStatepersist='local'
FieldTypeDefault@validator
textstr''—
Driving that state from an event:Client actions →· the live reflection in detail:Client reactivity →