Actions
Actions are the commands that make things happen in your Rhyme app. They create user interface elements, handle user input, manage data, and control the flow of your app.
What are Actions?
Think of actions as the verbs in your app - they’re what you use to:
- Display content (
.text,.title,.image) - Get user input (
.button,.enter-text,.select) - Work with data (
set,calc,if) - Navigate between screens (
goto,call) - And much more!
Basic Action Syntax
Every action starts with a dot (.) or is a special command:
// Display actions
.title "Welcome to My App"
.text "This is some content"
.button "Click Me" [next-screen]
// Data actions
set $user-name = "Alice"
calc $total = $price * $quantity
// Flow control
if $logged-in
goto [dashboard]
else
goto [login]Action Categories
Actions are organized into logical groups:
- Display Actions - Show content to users
- Input Actions - Collect information from users
- Data Actions - Work with variables and values
- Flow Actions - Control navigation and logic
- Media Actions - Handle images, audio, and video
- System Actions - Special platform features
Learn More
Explore the different types of actions available in Rhyme to build powerful, interactive apps!
Display Actions
Display actions are used to show content and create the visual elements of your app.
Common Display Actions
.title
Shows a prominent heading:
.title "Welcome to My App".text
Displays regular text content:
.text "This is a paragraph of text".image
Shows an image:
.image "logo.png".icon
Displays an icon:
.icon "home"Styling Display Actions
Many display actions support modifiers for styling:
.title "Big Title" -size:large -color:blue
.text "Important!" -bold -centerMore content coming soon…
Input Actions
Input actions let users interact with your app by entering data, making choices, and triggering events.
Button Actions
.button
Creates a clickable button:
.button "Next" [next-screen]
.button "Save" { set $saved = true }Text Input Actions
.enter-text
Single line text input:
.enter-text $user-name "Enter your name".enter-email
Email input with validation:
.enter-email $email "Your email address".enter-password
Password input (hidden text):
.enter-password $password "Enter password"Selection Actions
.select
Dropdown selection:
.select $color "Choose a color" ["Red", "Blue", "Green"].switch
Toggle switch:
Data Actions
Data actions help you work with variables, perform calculations, and manage the state of your app.
Setting Variables
set
Assigns a value to a variable:
set $name = "Alice"
set $age = 25
set $logged-in = trueCalculations
calc
Performs mathematical operations:
calc $total = $price * $quantity
calc $discount = $total * 0.1
calc $final = $total - $discountWorking with Lists
append
Adds items to a list:
append $shopping-list = "Milk"
append $shopping-list = "Bread"remove
Removes items from a list:
Flow Actions
Flow actions control how your app moves between screens and makes decisions based on conditions.
Navigation
goto
Jumps to another block:
goto [home]
goto [user-profile]call
Calls a block and returns:
call [validate-input]
call [calculate-total]return
Returns from a called block:
return
return $resultConditional Logic
if/else
Makes decisions based on conditions:
if $age >= 18
.text "Welcome!"
goto [adult-content]
else
.text "Sorry, you must be 18+"
goto [home]
endswitch
Handles multiple conditions:
switch $menu-choice
case "pizza"
goto [pizza-options]
case "burger"
goto [burger-options]
default
goto [main-menu]
endMore content coming soon…
Understanding Actions
Actions are the building blocks of every Rhyme app. They’re like Lego pieces - each one does something specific, and you combine them to build amazing things.
what are actions?
Actions are pre-built commands that handle common tasks:
- Displaying text and images
- Getting input from users
- Saving and loading data
- Making decisions
- And much more!
action format
Every action follows this pattern:
category/name parametersFor example:
text/title "Welcome!"- Shows a titlebutton/text "Click me"- Creates a buttondata/set $score = 100- Saves a value
action categories
Actions are organized into categories by what they do: