$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
communityintermediate

makepad-basics

Share

|

Works with OpenClaude

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

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:

  1. Read the relevant reference file(s) listed above
  2. 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
  3. 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/TypeDescriptionExample
live_design!Defines UI in DSLlive_design! { App = {{App}} { ... } }
app_main!Entry point macroapp_main!(App);
#[derive(Live)]Derive live data#[derive(Live, LiveHook)]
WidgetRefReference to UI tree#[live] ui: WidgetRef
CxContext for renderingfn handle_event(&mut self, cx: &mut Cx, ...)
id!()Widget ID macroself.ui.button(id!(my_button))

Platform Setup

PlatformRequirements
macOSWorks out of the box
WindowsWorks out of the box
Linuxapt-get install clang libaudio-dev libpulse-dev libx11-dev libxcursor-dev
Webcargo install wasm-pack

When Writing Code

  1. Always include required imports: use makepad_widgets::*;
  2. Use live_design! macro for all UI definitions
  3. Implement LiveRegister and AppMain traits
  4. Use id!() macro for widget references
  5. Handle events through handle_event method

When Answering Questions

  1. Emphasize live design - changes in DSL reflect instantly without recompilation
  2. Makepad is GPU-first - all rendering is shader-based
  3. Cross-platform: same code runs on Android, iOS, Linux, macOS, Windows, Web
  4. Recommend UI Zoo example for widget exploration

Quick Info

Categorycommunity
Difficultyintermediate
Version1.0.0
Authorantigravity
communityantigravity

Install command:

Related community Skills

Other Claude Code skills in the same category — free to download.

Want a community skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.