Skip to content

What is a block?

If you’ve ever clicked a link on a website and landed on a new page, you already understand blocks. A block is a screen — one full view the user sees at a time. Your app can have as many blocks as you need, and users move between them as they use the app.

Declaring a block

A block is declared by putting its name in square brackets on a line by itself. Everything that follows belongs to that block:

[home]
.header "Welcome"
.text "This is the home screen."
[settings]
.header "Settings"
.text "Adjust your preferences here."

Each [name] line starts a new block. The block continues until the next [name] declaration.

Every app starts with [home]

The block named [home] is the first screen users see when they open the app. Every Rhappsody app has one.

As your app grows, you add more blocks: a settings screen, a detail view, a results page, a confirmation step. Each is its own block with its own Rhyme code.

Use goto to move from one block to another:

goto [settings]

The name in brackets must match a block declared in your app. You can trigger goto from a button:

.button "Open settings"
goto [settings]

Tapping the button takes the user to the [settings] block.

Running setup logic when the app starts

The [launch] block is a special block that runs once when the app first starts — before [home] is shown. Use it for one-time setup: setting initial values, configuring layout, or defining connections.

[launch]
$welcome-message = "Hello!"
remember $welcome-message
[home]
.text "Tap below to get started."

[launch] runs silently in the background. Users never see it directly — they land on [home] after it completes.

Blocks vs. the overall app

The relationship between blocks and your app is simple:

  • App — the container users install or open
  • Block — one screen within that app ([home], [settings], etc.)
  • Actions — the content and behavior inside each block

Most small apps need only two or three blocks. Larger apps might have dozens. Either way, the structure stays the same: [home] is always the starting point, and users navigate between the rest with goto.