Supporting material availability
This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:
./references/app-structure.md
./references/event-handling.md
Obtain the required material from the declared upstream source, or from a user-provided installation of that source. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.
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-basics-23description: |4 CRITICAL: Use for Makepad getting started and app structure. Triggers on:5 makepad, makepad getting started, makepad tutorial, live_design!, app_main!,6 makepad project setup, makepad hello world, "how to create makepad app",7 makepad 入门, 创建 makepad 应用, makepad 教程, makepad 项目结构8risk: critical9source: "https://github.com/makepad/makepad"10date_added: "2026-03-06"11metadata:12 source: https://skillmd.com/skills/iradoweck/makepad-basics-213---1415## Supporting material availability1617This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:1819- `./references/app-structure.md`20- `./references/event-handling.md`2122Obtain the required material from the [declared upstream source](https://github.com/makepad/makepad), or from a user-provided installation of that source. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.232425# Makepad Basics Skill2627> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-1928>29> Check for updates: https://crates.io/crates/makepad-widgets3031You are an expert at the Rust `makepad-widgets` crate. Help users by:32- **Writing code**: Generate Rust code following the patterns below33- **Answering questions**: Explain concepts, troubleshoot issues, reference documentation3435## When to Use36- You need to get started with Makepad or understand basic app structure and boilerplate.37- The task involves project setup, `live_design!`, `app_main!`, or first-screen application wiring.38- You want foundational Makepad guidance before moving into more specific layout, widget, or shader topics.3940## Documentation4142Refer to the local files for detailed documentation:43- `./references/app-structure.md` - Complete app boilerplate and structure44- `./references/event-handling.md` - Event handling patterns4546## IMPORTANT: Documentation Completeness Check4748**Before answering questions, Claude MUST:**49501. Read the relevant reference file(s) listed above512. If file read fails or file is empty:52 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"53 - Still answer based on SKILL.md patterns + built-in knowledge543. If reference file exists, incorporate its content into the answer5556## Key Patterns5758### 1. Basic App Structure5960```rust61use makepad_widgets::*;6263live_design! {64 use link::theme::*;65 use link::shaders::*;66 use link::widgets::*;6768 App = {{App}} {69 ui: <Root> {70 main_window = <Window> {71 body = <View> {72 width: Fill, height: Fill73 flow: Down7475 <Label> { text: "Hello Makepad!" }76 }77 }78 }79 }80}8182app_main!(App);8384#[derive(Live, LiveHook)]85pub struct App {86 #[live] ui: WidgetRef,87}8889impl LiveRegister for App {90 fn live_register(cx: &mut Cx) {91 crate::makepad_widgets::live_design(cx);92 }93}9495impl AppMain for App {96 fn handle_event(&mut self, cx: &mut Cx, event: &Event) {97 self.ui.handle_event(cx, event, &mut Scope::empty());98 }99}100```101102### 2. Cargo.toml Setup103104```toml105[package]106name = "my_app"107version = "0.1.0"108edition = "2024"109110[dependencies]111makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "dev" }112```113114### 3. Handling Button Clicks115116```rust117impl AppMain for App {118 fn handle_event(&mut self, cx: &mut Cx, event: &Event) {119 let actions = self.ui.handle_event(cx, event, &mut Scope::empty());120121 if self.ui.button(id!(my_button)).clicked(&actions) {122 log!("Button clicked!");123 }124 }125}126```127128### 4. Accessing and Modifying Widgets129130```rust131// Get widget references132let label = self.ui.label(id!(my_label));133label.set_text("Updated text");134135let input = self.ui.text_input(id!(my_input));136let text = input.text();137```138139## API Reference Table140141| Macro/Type | Description | Example |142|------------|-------------|---------|143| `live_design!` | Defines UI in DSL | `live_design! { App = {{App}} { ... } }` |144| `app_main!` | Entry point macro | `app_main!(App);` |145| `#[derive(Live)]` | Derive live data | `#[derive(Live, LiveHook)]` |146| `WidgetRef` | Reference to UI tree | `#[live] ui: WidgetRef` |147| `Cx` | Context for rendering | `fn handle_event(&mut self, cx: &mut Cx, ...)` |148| `id!()` | Widget ID macro | `self.ui.button(id!(my_button))` |149150## Platform Setup151152| Platform | Requirements |153|----------|--------------|154| macOS | Works out of the box |155| Windows | Works out of the box |156| Linux | `apt-get install clang libaudio-dev libpulse-dev libx11-dev libxcursor-dev` |157| Web | `cargo install wasm-pack` |158159## When Writing Code1601611. Always include required imports: `use makepad_widgets::*;`1622. Use `live_design!` macro for all UI definitions1633. Implement `LiveRegister` and `AppMain` traits1644. Use `id!()` macro for widget references1655. Handle events through `handle_event` method166167## When Answering Questions1681691. Emphasize live design - changes in DSL reflect instantly without recompilation1702. Makepad is GPU-first - all rendering is shader-based1713. Cross-platform: same code runs on Android, iOS, Linux, macOS, Windows, Web1724. Recommend UI Zoo example for widget exploration173174## Limitations175- Use this skill only when the task clearly matches the scope described above.176- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.177- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.