Cookie Manager (persist preferences)
Persist lightweight preferences across sessions with Cookie Manager, including optional expiration and cookie options.
Cookie Manager
Section titled “Cookie Manager”Cookie Manager persists lightweight values across reloads and browser restarts — ideal for preferences and consent flags.
When cookies are the right choice
Section titled “When cookies are the right choice”Use cookies when state should persist across sessions and you need to send it to the server (or you simply want the simplest persistence).
Cookie values are strings
Section titled “Cookie values are strings”Cookie values are strings. Store structured data only if you’re sure it’s needed (and keep it small).
tip: Avoid storing sensitive data in cookies; use server-side sessions for auth.
Core workflow
Section titled “Core workflow”Read cookie values in bindings, and write/remove them with actions.
Read cookies in bindings
Section titled “Read cookies in bindings”Use cookieManager.key in expressions to drive UI (show/hide, text, classes).
Set a cookie with options
Section titled “Set a cookie with options”Use cookie.set(name, value, options) to persist a preference. Options can include expires/path/domain/secure.
Pattern: theme preference
Section titled “Pattern: theme preference”Bind UI theme class to a cookie value. Provide controls to set/remove it.
Pattern: cookie consent banner
Section titled “Pattern: cookie consent banner”Show a banner until cookie_consent is set, then hide it permanently (until cleared).
Wrap-up
Section titled “Wrap-up”Next, choose between cookie/session/local based on lifetime.
Next steps
Section titled “Next steps”Pick a related tour to continue.