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.
Source: sickn33/agentic-awesome-skills → skills/makepad-basics/SKILL.md
Also appears in: sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills/skills/makepad-basics/SKILL.md, sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/makepad-basics/SKILL.md, sickn33/agentic-awesome-skills/plugins/agentic-bundle-makepad-builder/skills/makepad-basics/SKILL.md
1---2name: makepad-basics3description: "| CRITICAL: Use for Makepad getting started and app structure. Triggers on: makepad, makepad getting started, makepad tutorial, live_design!, app_main!, makepad project setup, makepad hello world, \"how to create makepad app\", makepad 入门, 创建 makepad 应用, makepad 教程, makepad 项目结构"4category: docs-and-knowledge-mgmt5source_repo: sickn33/agentic-awesome-skills6source_path: "skills/makepad-basics/SKILL.md"7source_url: https://github.com/sickn33/agentic-awesome-skills/blob/HEAD/skills/makepad-basics/SKILL.md8metadata:9 source: https://skillmd.com/skills/thedixitjain/makepad-basics10---111213# Makepad Basics Skill1415> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-1916>17> Check for updates: https://crates.io/crates/makepad-widgets1819You are an expert at the Rust `makepad-widgets` crate. Help users by:20- **Writing code**: Generate Rust code following the patterns below21- **Answering questions**: Explain concepts, troubleshoot issues, reference documentation2223## When to Use24- You need to get started with Makepad or understand basic app structure and boilerplate.25- The task involves project setup, `live_design!`, `app_main!`, or first-screen application wiring.26- You want foundational Makepad guidance before moving into more specific layout, widget, or shader topics.2728## Documentation2930Refer to the local files for detailed documentation:31- `./references/app-structure.md` - Complete app boilerplate and structure32- `./references/event-handling.md` - Event handling patterns3334## IMPORTANT: Documentation Completeness Check3536**Before answering questions, Claude MUST:**37381. Read the relevant reference file(s) listed above392. If file read fails or file is empty:40 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"41 - Still answer based on SKILL.md patterns + built-in knowledge423. If reference file exists, incorporate its content into the answer4344## Key Patterns4546### 1. Basic App Structure4748```rust49use makepad_widgets::*;5051live_design! {52 use link::theme::*;53 use link::shaders::*;54 use link::widgets::*;5556 App = {{App}} {57 ui: <Root> {58 main_window = <Window> {59 body = <View> {60 width: Fill, height: Fill61 flow: Down6263 <Label> { text: "Hello Makepad!" }64 }65 }66 }67 }68}6970app_main!(App);7172#[derive(Live, LiveHook)]73pub struct App {74 #[live] ui: WidgetRef,75}7677impl LiveRegister for App {78 fn live_register(cx: &mut Cx) {79 crate::makepad_widgets::live_design(cx);80 }81}8283impl AppMain for App {84 fn handle_event(&mut self, cx: &mut Cx, event: &Event) {85 self.ui.handle_event(cx, event, &mut Scope::empty());86 }87}88```8990### 2. Cargo.toml Setup9192```toml93[package]94name = "my_app"95version = "0.1.0"96edition = "2024"9798[dependencies]99makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "dev" }100```101102### 3. Handling Button Clicks103104```rust105impl AppMain for App {106 fn handle_event(&mut self, cx: &mut Cx, event: &Event) {107 let actions = self.ui.handle_event(cx, event, &mut Scope::empty());108109 if self.ui.button(id!(my_button)).clicked(&actions) {110 log!("Button clicked!");111 }112 }113}114```115116### 4. Accessing and Modifying Widgets117118```rust119// Get widget references120let label = self.ui.label(id!(my_label));121label.set_text("Updated text");122123let input = self.ui.text_input(id!(my_input));124let text = input.text();125```126127## API Reference Table128129| Macro/Type | Description | Example |130|------------|-------------|---------|131| `live_design!` | Defines UI in DSL | `live_design! { App = {{App}} { ... } }` |132| `app_main!` | Entry point macro | `app_main!(App);` |133| `#[derive(Live)]` | Derive live data | `#[derive(Live, LiveHook)]` |134| `WidgetRef` | Reference to UI tree | `#[live] ui: WidgetRef` |135| `Cx` | Context for rendering | `fn handle_event(&mut self, cx: &mut Cx, ...)` |136| `id!()` | Widget ID macro | `self.ui.button(id!(my_button))` |137138## Platform Setup139140| Platform | Requirements |141|----------|--------------|142| macOS | Works out of the box |143| Windows | Works out of the box |144| Linux | `apt-get install clang libaudio-dev libpulse-dev libx11-dev libxcursor-dev` |145| Web | `cargo install wasm-pack` |146147## When Writing Code1481491. Always include required imports: `use makepad_widgets::*;`1502. Use `live_design!` macro for all UI definitions1513. Implement `LiveRegister` and `AppMain` traits1524. Use `id!()` macro for widget references1535. Handle events through `handle_event` method154155## When Answering Questions1561571. Emphasize live design - changes in DSL reflect instantly without recompilation1582. Makepad is GPU-first - all rendering is shader-based1593. Cross-platform: same code runs on Android, iOS, Linux, macOS, Windows, Web1604. Recommend UI Zoo example for widget exploration161162## Limitations163- Use this skill only when the task clearly matches the scope described above.164- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.165- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.166167---168169**Source:** [`sickn33/agentic-awesome-skills`](https://github.com/sickn33/agentic-awesome-skills) → `skills/makepad-basics/SKILL.md`170171**Also appears in:** `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills/skills/makepad-basics/SKILL.md`, `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/makepad-basics/SKILL.md`, `sickn33/agentic-awesome-skills/plugins/agentic-bundle-makepad-builder/skills/makepad-basics/SKILL.md`