Agent skill
makepad-widgets
CRITICAL: Use for Makepad widgets and UI components. Triggers on: makepad widget, makepad View, makepad Button, makepad Label, makepad Image, makepad TextInput, RoundedView, SolidView, ScrollView, "makepad component", makepad Markdown, makepad Html, TextFlow, rich text, 富文本, markdown渲染, makepad 组件, makepad 按钮, makepad 列表, makepad 视图, makepad 输入框
Install this agent skill to your Project
npx add-skill https://github.com/ZhangHanDong/makepad-skills/tree/main/skills/makepad-widgets
SKILL.md
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
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
- Inform user: "本地文档不完整,建议运行
- 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
widthandheighton widgets - Use
show_bg: trueto enable background rendering - Access
draw_bg,draw_text,draw_iconfor 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
animatorproperty
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
makepad-splash
CRITICAL: Use for Makepad Splash scripting language. Triggers on: splash language, makepad script, makepad scripting, script!, cx.eval, makepad dynamic, makepad AI, splash 语言, makepad 脚本
makepad-platform
CRITICAL: Use for Makepad cross-platform support. Triggers on: makepad platform, makepad os, makepad macos, makepad windows, makepad linux, makepad android, makepad ios, makepad web, makepad wasm, makepad metal, makepad d3d11, makepad opengl, makepad webgl, OsType, CxOs, makepad 跨平台, makepad 平台支持
robius-app-architecture
CRITICAL: Use for Robius app architecture patterns. Triggers on: Tokio, async, submit_async_request, 异步, 架构, SignalToUI, Cx::post_action, worker task, app structure, MatchEvent, handle_startup
robius-event-action
CRITICAL: Use for Robius event and action patterns. Triggers on: custom action, MatchEvent, post_action, cx.widget_action, handle_actions, DefaultNone, widget action, event handling, 事件处理, 自定义动作
robius-widget-patterns
CRITICAL: Use for Robius widget patterns. Triggers on: apply_over, TextOrImage, modal, 可复用, 模态, collapsible, drag drop, reusable widget, widget design, pageflip, 组件设计, 组件模式
makepad-reference
CRITICAL: Use for Makepad troubleshooting and reference. Triggers on: troubleshoot, error, debug, fix, problem, issue, no matching field, parse error, widget not found, UI not updating, code quality, refactor, responsive layout, adaptive, api docs, reference, documentation, 故障排除, 错误, 调试, 问题, 修复
Didn't find tool you were looking for?