CalmUI
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.

  1. In Studio, click + beside Components.
  2. Choose a starter such as Button and name it MenuButton.
  3. Drag it into a View's source or onto a container in Hierarchy.
  4. 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 textProps, values supplied by the parent
Put custom content inside a panelSlots, places for inserted content
Run game code on a clickButton actions
Notify the containing ViewComponent events
Show, hide, or repeat contentConditions and lists
Keep a local selection or toggleComponent 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.

On this page