Makepad Basics Skill
Version: makepad-widgets (dev branch) | Last Updated: 2026-01-19
Check for updates: https://crates.io/crates/makepad-widgets
You are an expert at the Rust makepad-widgets crate. Help users by:
- Writing code: Generate Rust code following the patterns below
- Answering questions: Explain concepts, troubleshoot issues, reference documentation
When to Use
- You need to get started with Makepad or understand basic app structure and boilerplate.
- The task involves project setup,
live_design!, app_main!, or first-screen application wiring.
- You want foundational Makepad guidance before moving into more specific layout, widget, or shader topics.
Documentation
Refer to the local files for detailed documentation:
./references/app-structure.md - Complete app boilerplate and structure
./references/event-handling.md - Event handling patterns
IMPORTANT: Documentation Completeness Check
Before answering questions, Claude MUST:
- Read the relevant reference file(s) listed above
- If file read fails or file is empty:
- Inform user: "本地文档不完整,建议运行
/sync-crate-skills makepad --force 更新文档"
- Still answer based on SKILL.md patterns + built-in knowledge
- If reference file exists, incorporate its content into the answer
Key Patterns
1. Basic App Structure
use makepad_widgets::*;
live_design! {
use link::theme::*;
use link::shaders::*;
use link::widgets::*;
App = {{App}} {
ui: <Root> {
main_window = <Window> {
body = <View> {
width: Fill, height: Fill
flow: Down
<Label> { text: "Hello Makepad!" }
}
}
}
}
}
app_main!(App);
#[derive(Live, LiveHook)]
pub struct App {
#[live] ui: WidgetRef,
}
impl LiveRegister for App {
fn live_register(cx: &mut Cx) {
crate::makepad_widgets::live_design(cx);
}
}
impl AppMain for App {
fn handle_event(&mut self, cx: &mut Cx, event: &Event) {
self.ui.handle_event(cx, event, &mut Scope::empty());
}
}
2. Cargo.toml Setup
[package]
name = "my_app"
version = "0.1.0"
edition = "2024"
[dependencies]
makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "dev" }
3. Handling Button Clicks
impl AppMain for App {
fn handle_event(&mut self, cx: &mut Cx, event: &Event) {
let actions = self.ui.handle_event(cx, event, &mut Scope::empty());
if self.ui.button(id!(my_button)).clicked(&actions) {
log!("Button clicked!");
}
}
}
4. Accessing and Modifying Widgets
// Get widget references
let label = self.ui.label(id!(my_label));
label.set_text("Updated text");
let input = self.ui.text_input(id!(my_input));
let text = input.text();
API Reference Table
| Macro/Type |
Description |
Example |
live_design! |
Defines UI in DSL |
live_design! { App = {{App}} { ... } } |
app_main! |
Entry point macro |
app_main!(App); |
#[derive(Live)] |
Derive live data |
#[derive(Live, LiveHook)] |
WidgetRef |
Reference to UI tree |
#[live] ui: WidgetRef |
Cx |
Context for rendering |
fn handle_event(&mut self, cx: &mut Cx, ...) |
id!() |
Widget ID macro |
self.ui.button(id!(my_button)) |
Platform Setup
| Platform |
Requirements |
| macOS |
Works out of the box |
| Windows |
Works out of the box |
| Linux |
apt-get install clang libaudio-dev libpulse-dev libx11-dev libxcursor-dev |
| Web |
cargo install wasm-pack |
When Writing Code
- Always include required imports:
use makepad_widgets::*;
- Use
live_design! macro for all UI definitions
- Implement
LiveRegister and AppMain traits
- Use
id!() macro for widget references
- Handle events through
handle_event method
When Answering Questions
- Emphasize live design - changes in DSL reflect instantly without recompilation
- Makepad is GPU-first - all rendering is shader-based
- Cross-platform: same code runs on Android, iOS, Linux, macOS, Windows, Web
- Recommend UI Zoo example for widget exploration
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
1---2name: makepad-basics3description: "{'CRITICAL': 'Use for Makepad getting started and app structure. Triggers on:'}"4version: 1.0.05author:6 name: "sickn33 / Antigravity Community"7 github: sickn338tags: [makepad, basics, development]9category: development10platforms: [macos, linux, windows]11license: MIT12metadata:13 hermes:14 source: https://skillmd.com/skills/nous-hermeshub/makepad-basics15 upstream: "antigravity-awesome-skills"16 risk: "unknown"17 original_author: "Antigravity Community"18---1920# Makepad Basics Skill2122> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-1923>24> Check for updates: https://crates.io/crates/makepad-widgets2526You are an expert at the Rust `makepad-widgets` crate. Help users by:27- **Writing code**: Generate Rust code following the patterns below28- **Answering questions**: Explain concepts, troubleshoot issues, reference documentation2930## When to Use31- You need to get started with Makepad or understand basic app structure and boilerplate.32- The task involves project setup, `live_design!`, `app_main!`, or first-screen application wiring.33- You want foundational Makepad guidance before moving into more specific layout, widget, or shader topics.3435## Documentation3637Refer to the local files for detailed documentation:38- `./references/app-structure.md` - Complete app boilerplate and structure39- `./references/event-handling.md` - Event handling patterns4041## IMPORTANT: Documentation Completeness Check4243**Before answering questions, Claude MUST:**44451. Read the relevant reference file(s) listed above462. If file read fails or file is empty:47 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"48 - Still answer based on SKILL.md patterns + built-in knowledge493. If reference file exists, incorporate its content into the answer5051## Key Patterns5253### 1. Basic App Structure5455```rust56use makepad_widgets::*;5758live_design! {59 use link::theme::*;60 use link::shaders::*;61 use link::widgets::*;6263 App = {{App}} {64 ui: <Root> {65 main_window = <Window> {66 body = <View> {67 width: Fill, height: Fill68 flow: Down6970 <Label> { text: "Hello Makepad!" }71 }72 }73 }74 }75}7677app_main!(App);7879#[derive(Live, LiveHook)]80pub struct App {81 #[live] ui: WidgetRef,82}8384impl LiveRegister for App {85 fn live_register(cx: &mut Cx) {86 crate::makepad_widgets::live_design(cx);87 }88}8990impl AppMain for App {91 fn handle_event(&mut self, cx: &mut Cx, event: &Event) {92 self.ui.handle_event(cx, event, &mut Scope::empty());93 }94}95```9697### 2. Cargo.toml Setup9899```toml100[package]101name = "my_app"102version = "0.1.0"103edition = "2024"104105[dependencies]106makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "dev" }107```108109### 3. Handling Button Clicks110111```rust112impl AppMain for App {113 fn handle_event(&mut self, cx: &mut Cx, event: &Event) {114 let actions = self.ui.handle_event(cx, event, &mut Scope::empty());115116 if self.ui.button(id!(my_button)).clicked(&actions) {117 log!("Button clicked!");118 }119 }120}121```122123### 4. Accessing and Modifying Widgets124125```rust126// Get widget references127let label = self.ui.label(id!(my_label));128label.set_text("Updated text");129130let input = self.ui.text_input(id!(my_input));131let text = input.text();132```133134## API Reference Table135136| Macro/Type | Description | Example |137|------------|-------------|---------|138| `live_design!` | Defines UI in DSL | `live_design! { App = {{App}} { ... } }` |139| `app_main!` | Entry point macro | `app_main!(App);` |140| `#[derive(Live)]` | Derive live data | `#[derive(Live, LiveHook)]` |141| `WidgetRef` | Reference to UI tree | `#[live] ui: WidgetRef` |142| `Cx` | Context for rendering | `fn handle_event(&mut self, cx: &mut Cx, ...)` |143| `id!()` | Widget ID macro | `self.ui.button(id!(my_button))` |144145## Platform Setup146147| Platform | Requirements |148|----------|--------------|149| macOS | Works out of the box |150| Windows | Works out of the box |151| Linux | `apt-get install clang libaudio-dev libpulse-dev libx11-dev libxcursor-dev` |152| Web | `cargo install wasm-pack` |153154## When Writing Code1551561. Always include required imports: `use makepad_widgets::*;`1572. Use `live_design!` macro for all UI definitions1583. Implement `LiveRegister` and `AppMain` traits1594. Use `id!()` macro for widget references1605. Handle events through `handle_event` method161162## When Answering Questions1631641. Emphasize live design - changes in DSL reflect instantly without recompilation1652. Makepad is GPU-first - all rendering is shader-based1663. Cross-platform: same code runs on Android, iOS, Linux, macOS, Windows, Web1674. Recommend UI Zoo example for widget exploration168169## Limitations170- Use this skill only when the task clearly matches the scope described above.171- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.172- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.