Makepad Widgets 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 Makepad widgets. Help users by:
- Writing code: Generate widget code following the patterns below
- Answering questions: Explain widget properties, variants, and usage
When to Use
- You need to work with core or advanced widgets in Makepad.
- The task involves widget selection, properties, variants, composition, or widget-specific behavior.
- You want examples for
View, Button, labels, rich text, or other makepad-widgets building blocks.
Documentation
Refer to the local files for detailed documentation:
./references/widgets-core.md - Core widgets (View, Button, Label, etc.)
./references/widgets-advanced.md - Helper and advanced widgets
./references/widgets-richtext.md - Rich text widgets (Markdown, Html, TextFlow)
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. View (Basic Container)
<View> {
width: Fill
height: Fill
flow: Down
padding: 16.0
show_bg: true
draw_bg: { color: #1A1A1A }
<Label> { text: "Content" }
}
2. Button
<Button> {
text: "Click Me"
draw_bg: {
color: #0066CC
color_hover: #0088FF
border_radius: 4.0
}
draw_text: {
color: #FFFFFF
text_style: { font_size: 14.0 }
}
}
3. Label with Styling
<Label> {
width: Fit
height: Fit
text: "Hello World"
draw_text: {
color: #FFFFFF
text_style: {
font_size: 16.0
line_spacing: 1.4
}
}
}
4. Image
<Image> {
width: 200.0
height: 150.0
source: dep("crate://self/resources/photo.png")
fit: Contain
}
5. TextInput
<TextInput> {
width: Fill
height: Fit
text: "Default value"
draw_text: {
text_style: { font_size: 14.0 }
}
}
Widget Traits (from source)
pub trait WidgetNode: LiveApply {
fn find_widgets(&self, path: &[LiveId], cached: WidgetCache, results: &mut WidgetSet);
fn walk(&mut self, cx: &mut Cx) -> Walk;
fn area(&self) -> Area;
fn redraw(&mut self, cx: &mut Cx);
}
pub trait Widget: WidgetNode {
fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {}
fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep;
fn draw(&mut self, cx: &mut Cx2d, scope: &mut Scope) -> DrawStep;
fn widget(&self, path: &[LiveId]) -> WidgetRef;
}
All Built-in Widgets (84 files in widgets/src/)
| Category |
Widgets |
| Basic |
View, Label, Button, Icon, Image |
| Input |
TextInput, CheckBox, RadioButton, Slider, DropDown, ColorPicker |
| Container |
ScrollBars, PortalList, FlatList, StackNavigation, Dock, Splitter |
| Navigation |
TabBar, Tab, FoldHeader, FoldButton, ExpandablePanel |
| Overlay |
Modal, Tooltip, PopupMenu, PopupNotification |
| Media |
Video, RotatedImage, ImageBlend, MultiImage |
| Layout |
AdaptiveView, SlidePanel, PageFlip, SlidesView |
| Special |
Markdown, Html, TextFlow, WebView, KeyboardView |
| Utility |
LoadingSpinner, DesktopButton, LinkLabel, ScrollShadow |
Core Widgets Reference
| Widget |
Purpose |
Key Properties |
View |
Container |
flow, align, show_bg, draw_bg, optimize |
Button |
Clickable |
text, draw_bg, draw_text, draw_icon |
Label |
Text display |
text, draw_text |
Image |
Image display |
source, fit |
TextInput |
Text entry |
text, draw_text, draw_cursor, draw_selection |
CheckBox |
Toggle |
text, selected |
RadioButton |
Selection |
text, selected |
Slider |
Value slider |
min, max, step |
DropDown |
Select menu |
labels, selected |
PortalList |
Virtual list |
Efficient scrolling for large lists |
Modal |
Dialog |
Overlay dialog boxes |
Tooltip |
Hint |
Hover tooltips |
View Variants
| Variant |
Description |
SolidView |
Solid background color |
RoundedView |
Rounded corners |
RoundedAllView |
Individual corner control |
RectView |
Rectangle with border/gradient |
CircleView |
Circle/ellipse shape |
GradientXView |
Horizontal gradient |
GradientYView |
Vertical gradient |
RoundedShadowView |
Rounded with shadow |
ScrollXView |
Horizontal scroll |
ScrollYView |
Vertical scroll |
ScrollXYView |
Both directions scroll |
CachedView |
Texture-cached |
Button Variants
| Variant |
Description |
ButtonFlat |
Flat style |
ButtonFlatIcon |
Flat with icon |
ButtonFlatter |
No background |
ButtonGradientX |
Horizontal gradient |
ButtonGradientY |
Vertical gradient |
ButtonIcon |
Standard with icon |
ImageFit Values
| Value |
Description |
Stretch |
Stretch to fill |
Contain |
Fit within, preserve ratio |
Cover |
Cover area, may crop |
Fill |
Fill without ratio |
When Writing Code
- Always set
width and height on widgets
- Use
show_bg: true to enable background rendering
- Access
draw_bg, draw_text, draw_icon for shader uniforms
- Use
dep("crate://self/...") for resource paths
- Choose appropriate View variant for visual needs
When Answering Questions
- Recommend UI Zoo example for widget exploration
- View is the base container - most visual widgets inherit from it
- Draw shaders (
draw_bg, draw_text) control appearance
- All widgets support animation through
animator property
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-widgets
3description: "Version: makepad-widgets (dev branch) | Last Updated: 2026-01-19 > > Check for updates: https://crates.io/crates/makepad-widgets"
4risk: safe
5source: community
6metadata:
7 source: https://skillmd.com/skills/arjumaan/makepad-widgets
8---
9
10# Makepad Widgets Skill
11
12> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-19
13>
14> Check for updates: https://crates.io/crates/makepad-widgets
15
16You are an expert at Makepad widgets. Help users by:
17- **Writing code**: Generate widget code following the patterns below
18- **Answering questions**: Explain widget properties, variants, and usage
19
20## When to Use
21- You need to work with core or advanced widgets in Makepad.
22- The task involves widget selection, properties, variants, composition, or widget-specific behavior.
23- You want examples for `View`, `Button`, labels, rich text, or other `makepad-widgets` building blocks.
24
25## Documentation
26
27Refer to the local files for detailed documentation:
28- `./references/widgets-core.md` - Core widgets (View, Button, Label, etc.)
29- `./references/widgets-advanced.md` - Helper and advanced widgets
30- `./references/widgets-richtext.md` - Rich text widgets (Markdown, Html, TextFlow)
31
32## IMPORTANT: Documentation Completeness Check
33
34**Before answering questions, Claude MUST:**
35
361. Read the relevant reference file(s) listed above
372. If file read fails or file is empty:
38 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"
39 - Still answer based on SKILL.md patterns + built-in knowledge
403. If reference file exists, incorporate its content into the answer
41
42## Key Patterns
43
44### 1. View (Basic Container)
45
46```rust
47<View> {
48 width: Fill
49 height: Fill
50 flow: Down
51 padding: 16.0
52 show_bg: true
53 draw_bg: { color: #1A1A1A }
54
55 <Label> { text: "Content" }
56}
57```
58
59### 2. Button
60
61```rust
62<Button> {
63 text: "Click Me"
64 draw_bg: {
65 color: #0066CC
66 color_hover: #0088FF
67 border_radius: 4.0
68 }
69 draw_text: {
70 color: #FFFFFF
71 text_style: { font_size: 14.0 }
72 }
73}
74```
75
76### 3. Label with Styling
77
78```rust
79<Label> {
80 width: Fit
81 height: Fit
82 text: "Hello World"
83 draw_text: {
84 color: #FFFFFF
85 text_style: {
86 font_size: 16.0
87 line_spacing: 1.4
88 }
89 }
90}
91```
92
93### 4. Image
94
95```rust
96<Image> {
97 width: 200.0
98 height: 150.0
99 source: dep("crate://self/resources/photo.png")
100 fit: Contain
101}
102```
103
104### 5. TextInput
105
106```rust
107<TextInput> {
108 width: Fill
109 height: Fit
110 text: "Default value"
111 draw_text: {
112 text_style: { font_size: 14.0 }
113 }
114}
115```
116
117## Widget Traits (from source)
118
119```rust
120pub trait WidgetNode: LiveApply {
121 fn find_widgets(&self, path: &[LiveId], cached: WidgetCache, results: &mut WidgetSet);
122 fn walk(&mut self, cx: &mut Cx) -> Walk;
123 fn area(&self) -> Area;
124 fn redraw(&mut self, cx: &mut Cx);
125}
126
127pub trait Widget: WidgetNode {
128 fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {}
129 fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep;
130 fn draw(&mut self, cx: &mut Cx2d, scope: &mut Scope) -> DrawStep;
131 fn widget(&self, path: &[LiveId]) -> WidgetRef;
132}
133```
134
135## All Built-in Widgets (84 files in widgets/src/)
136
137| Category | Widgets |
138|----------|---------|
139| **Basic** | `View`, `Label`, `Button`, `Icon`, `Image` |
140| **Input** | `TextInput`, `CheckBox`, `RadioButton`, `Slider`, `DropDown`, `ColorPicker` |
141| **Container** | `ScrollBars`, `PortalList`, `FlatList`, `StackNavigation`, `Dock`, `Splitter` |
142| **Navigation** | `TabBar`, `Tab`, `FoldHeader`, `FoldButton`, `ExpandablePanel` |
143| **Overlay** | `Modal`, `Tooltip`, `PopupMenu`, `PopupNotification` |
144| **Media** | `Video`, `RotatedImage`, `ImageBlend`, `MultiImage` |
145| **Layout** | `AdaptiveView`, `SlidePanel`, `PageFlip`, `SlidesView` |
146| **Special** | `Markdown`, `Html`, `TextFlow`, `WebView`, `KeyboardView` |
147| **Utility** | `LoadingSpinner`, `DesktopButton`, `LinkLabel`, `ScrollShadow` |
148
149## Core Widgets Reference
150
151| Widget | Purpose | Key Properties |
152|--------|---------|----------------|
153| `View` | Container | `flow`, `align`, `show_bg`, `draw_bg`, `optimize` |
154| `Button` | Clickable | `text`, `draw_bg`, `draw_text`, `draw_icon` |
155| `Label` | Text display | `text`, `draw_text` |
156| `Image` | Image display | `source`, `fit` |
157| `TextInput` | Text entry | `text`, `draw_text`, `draw_cursor`, `draw_selection` |
158| `CheckBox` | Toggle | `text`, `selected` |
159| `RadioButton` | Selection | `text`, `selected` |
160| `Slider` | Value slider | `min`, `max`, `step` |
161| `DropDown` | Select menu | `labels`, `selected` |
162| `PortalList` | Virtual list | Efficient scrolling for large lists |
163| `Modal` | Dialog | Overlay dialog boxes |
164| `Tooltip` | Hint | Hover tooltips |
165
166## View Variants
167
168| Variant | Description |
169|---------|-------------|
170| `SolidView` | Solid background color |
171| `RoundedView` | Rounded corners |
172| `RoundedAllView` | Individual corner control |
173| `RectView` | Rectangle with border/gradient |
174| `CircleView` | Circle/ellipse shape |
175| `GradientXView` | Horizontal gradient |
176| `GradientYView` | Vertical gradient |
177| `RoundedShadowView` | Rounded with shadow |
178| `ScrollXView` | Horizontal scroll |
179| `ScrollYView` | Vertical scroll |
180| `ScrollXYView` | Both directions scroll |
181| `CachedView` | Texture-cached |
182
183## Button Variants
184
185| Variant | Description |
186|---------|-------------|
187| `ButtonFlat` | Flat style |
188| `ButtonFlatIcon` | Flat with icon |
189| `ButtonFlatter` | No background |
190| `ButtonGradientX` | Horizontal gradient |
191| `ButtonGradientY` | Vertical gradient |
192| `ButtonIcon` | Standard with icon |
193
194## ImageFit Values
195
196| Value | Description |
197|-------|-------------|
198| `Stretch` | Stretch to fill |
199| `Contain` | Fit within, preserve ratio |
200| `Cover` | Cover area, may crop |
201| `Fill` | Fill without ratio |
202
203## When Writing Code
204
2051. Always set `width` and `height` on widgets
2062. Use `show_bg: true` to enable background rendering
2073. Access `draw_bg`, `draw_text`, `draw_icon` for shader uniforms
2084. Use `dep("crate://self/...")` for resource paths
2095. Choose appropriate View variant for visual needs
210
211## When Answering Questions
212
2131. Recommend UI Zoo example for widget exploration
2142. View is the base container - most visual widgets inherit from it
2153. Draw shaders (`draw_bg`, `draw_text`) control appearance
2164. All widgets support animation through `animator` property
217
218## Limitations
219- Use this skill only when the task clearly matches the scope described above.
220- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
221- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.