Components
Reusable Components
Create a button once and use it in several Views.
A component is a reusable part of a View, such as a button, panel, or label. Editing the component updates every place that uses it.
- In Studio, click + beside Components.
- Choose a starter such as Button and name it
MenuButton. - Drag it into a View's source or onto a container in Hierarchy.
- Save the View. Studio adds the component and its import.
Follow Create a component for a complete example.
Choose what the component needs
| I want to… | Use |
|---|---|
| Give each button different text | Props, values supplied by the parent |
| Put custom content inside a panel | Slots, places for inserted content |
| Run game code on a click | Button actions |
| Notify the containing View | Component events |
| Show, hide, or repeat content | Conditions and lists |
| Keep a local selection or toggle | Component scripts |
Each component lives in a .calmui file. Its template describes its contents,
CSS sets its appearance, and an optional script adds local behavior. See
File structure when editing source directly.