> For the complete documentation index, see [llms.txt](https://hyperdapp.gitbook.io/code-editor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hyperdapp.gitbook.io/code-editor/guides/ui-state.md).

# UI State

* ***UI State*** is useful for keeping track of the current view and state of your application.
* To set/update a UI state variable, use the ***set()*** predicate:

```
// SYNTAX
set(var_id, var_value)

// EXAMPLE
prompt :-
  show [
    button('Create Guestbook', [ set(tab, create) ]),
    button('View Guestbook', [ set(tab, view) ]),
    button('Open Guestbook', [ set(tab, open) ])
  ].
```

{% hint style="warning" %}
`var_id` must be in *snake\_case* **OR** *camelCase*.
{% endhint %}

* To get the current value of a UI state variable, use the ***get()*** predicate:

```
// SYNTAX
get(var_id, var_value)

// EXAMPLE
prompt :- get(tab, create), show[text('Create Prompt')].
prompt :- get(tab, view), show[text('View Prompt')].
prompt :- get(tab, open), show[text('Open Prompt')].
```
