Skip to main content

RPGView

Views are the main way you can display things in the RPG Companion App. Notably, characters can have character sheet sections, search item views or creation pages. All of these will contain views.

Similarly, resources will also have views in the form of display, list, search and edit views.

All views should have a unique id, and specify its type. There's several different view types to choose from, which will allow you to create different layouts depending on what you want to display and how you want the app experience to be like for your system.

The RPG Companion App has 2 view modes: view mode and edit mode. Some views will change their behavior depending on the mode the app is currently on (for example, when editing a character sheet). Each view will explain what its behavior will be like.

If a view can be used to modify an existing stat, the stat value will only be updated once the player hits the "Save" button (unless the view has a property for auto-saving and you set it). However, you can always access the value for the stat that's set on the view (ie: the value to be saved once the "Save" button is hit and all validation messages return null) by utilizing the special $view stat in your path.

e.g: If you have a Select view with id weapon_type, you can access the value the player has selected by using the stat path $view?.weapon_type?. Note the use of the conditional access modifier ? in the path. There might be moments where the $view (and its substats) might not be defined, so you should always brace for it. The DefaultIfNull stat formula is your best friend in these scenarios.

Subtypes

The following types are available: