# 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')].
```
