makepad-2-0-events
makepad-2-0-events is an code AI skill with a core value of Makepad 2. It
helps developers solve real-world problems in the code domain, boosting
efficiency, automating repetitive tasks, and optimizing workflows.
Makepad 2.0 guidance for events; use when building or debugging Makepad UI code.
Quick Facts
mkdir -p ./skills/makepad-2-0-events && curl -sfL https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/skills/makepad-2-0-events/SKILL.md -o ./skills/makepad-2-0-events/SKILL.md Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).
Skill Content
Limitations
- Verify against current Makepad 2.0 docs; upstream APIs change frequently.
- Do not run bundled scripts without explicit user approval.
When to Use
- Use when this upstream workflow matches the user's stated goal.
- Use when the task requires the procedures documented in this skill.
# Makepad 2.0 Event & Action System
Overview
Makepad 2.0 uses a **two-layer event system**:
1. **Splash Layer** -- Inline event handlers written directly in `script_mod!` Splash code
(`on_click`, `on_render`, `on_return`, `on_startup`). These handle UI interactions
declaratively inside the script, close to the widget definitions.
2. **Rust Layer** -- The `MatchEvent` trait with `handle_actions`, `handle_timer`,
`handle_http_response`, etc. These handle business logic, external I/O, and
anything that needs full Rust power.
Both layers communicate through two bridge macros:
- `script_eval!(cx, { ... })` -- Execute Splash code from Rust (update state, trigger renders)
- `script_apply_eval!(cx, widget_ref, { ... })` -- Patch widget properties from Rust at runtime
---
1. Splash Inline Event Handlers
Event handlers are attached directly to widgets inside `script_mod!` blocks. They use
closure syntax with `||` for no arguments or `|arg|` for callbacks that receive a value.
on_click -- Button/widget click
Fires when the user clicks a button or clickable widget. No arguments for plain buttons,
or `|checked|` for CheckBox which passes the new boolean state.
// Plain button click
add_button := Button{
text: "Add"
on_click: ||{
let text = ui.todo_input.text()
if text != "" {
add_todo(text, "")
ui.todo_input.set_text("")
}
}
}
// CheckBox click with checked state argument
check.on_click: |checked| toggle_todo(i, checked)
// Inline delete with closure capturing loop variable
delete.on_click: || delete_todo(i)
// Calling another widget's click programmatically
clear_done := ButtonFlatter{
text: "Clear completed"
on_click: ||{
todos.retain(|todo| !todo.done)
ui.todo_list.render()
}
}on_render -- Dynamic rendering
Fires when `.render()` is called on the target view. This is the primary mechanism for
dynamic content. The body replaces the previous draw content of the view.
main_view := View{
width: Fill
height: Fill
on_render: ||{
counter_label := Label{
text: "Count: " + state.counter
draw_text.text_style.font_size: 24
}
}
}
// List rendering with for loop and per-item event handlers
todo_list := ScrollYView{
width: Fill height: Fill
new_batch: true
on_render: ||{
if todos.len() == 0
EmptyState{}
else for i, todo in todos {
TodoItem{
label.text: todo.text
check.active: todo.done
check.on_click: |checked| toggle_todo(i, checked)
delete.on_click: || delete_todo(i)
}
}
}
EmptyState{}
}**Key point**: `on_render` is NOT called automatically. You must call `ui.widget_name.render()`
to trigger it. The `new_batch: true` property on a view tells the system to clear previous
draw content before re-rendering.
on_return -- TextInput enter key
Fires when the user presses Enter/Return inside a TextInput. Commonly used to submit forms.
todo_input := TextInput{
width: Fill height: 9. * theme.space_1
empty_text: "What needs to be done?"
on_return: || ui.add_button.on_click()
}on_startup -- App startup
Fires once when the application starts. Defined at the `Root` level. Commonly used
to trigger initial renders.
ui: Root{
on_startup: ||{
ui.main_view.render()
}
main_window := Window{
// ...
}
}Event handler capabilities
Inside event handlers you can:
- Call Splash functions: `add_todo(text, "dev")`
- Read widget v
🎯 Best For
- Debugging engineers
- QA teams
- UI designers
- Product designers
- Claude users
💡 Use Cases
- Tracing runtime errors in production logs
- Identifying memory leaks
- Generating component mockups
- Creating design system tokens
📖 How to Use This Skill
- 1
Install the Skill
Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.
- 2
Load into Your AI Assistant
Open Claude and reference the skill. Paste the SKILL.md content or use the system prompt tab.
- 3
Apply makepad-2-0-events to Your Work
Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.
- 4
Review and Refine
Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.
❓ Frequently Asked Questions
Can this debug production issues?
Yes, but always ensure you have proper logging and monitoring in place first.
Does this work with Figma?
Some design skills integrate with Figma plugins. Check the Works With section for supported tools.
Is makepad-2-0-events compatible with Cursor and VS Code?
Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.
Do I need specific dependencies for makepad-2-0-events?
Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.
How do I install makepad-2-0-events?
Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/makepad-2-0-events/SKILL.md, ready to use.
⚠️ Common Mistakes to Avoid
Debugging without context
Always provide the full error stack and surrounding code context for accurate debugging.
Skipping usability testing
AI-generated designs should be validated with real users before development.
Skipping validation
Always test AI-generated code changes, even for simple refactors.
Missing dependency updates
Check if the skill requires updated dependencies or new packages.