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
- 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
AGI Framework Integration
Adapted for @techwavedev/agi-agent-kit
Original source: antigravity-awesome-skills
Memory-First Protocol
Retrieve prior decisions and patterns to avoid re-discovering solutions. Cache results for instant retrieval in future sessions.
# Check for prior development context before starting
python3 execution/memory_manager.py auto --query "prior work and patterns related to Makepad Widgets"
Storing Results
After completing work, store development decisions for future sessions:
python3 execution/memory_manager.py store \
--content "Completed task with key insights documented for future reference" \
--type decision --project <project> \
--tags makepad-widgets default
Multi-Agent Collaboration
Share outcomes with other agents so the team stays aligned and avoids duplicate work.
python3 execution/cross_agent_context.py store \
--agent "<your-agent>" \
--action "Task completed — results documented and shared with team" \
--project <project>
1---2name: makepad-widgets3description: |4 CRITICAL: Use for Makepad widgets and UI components. Triggers on:5 makepad widget, makepad View, makepad Button, makepad Label, makepad Image,6 makepad TextInput, RoundedView, SolidView, ScrollView, "makepad component",7 makepad Markdown, makepad Html, TextFlow, rich...8---910# Makepad Widgets Skill1112> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-1913>14> Check for updates: https://crates.io/crates/makepad-widgets1516You are an expert at Makepad widgets. Help users by:17- **Writing code**: Generate widget code following the patterns below18- **Answering questions**: Explain widget properties, variants, and usage1920## Documentation2122Refer to the local files for detailed documentation:23- `./references/widgets-core.md` - Core widgets (View, Button, Label, etc.)24- `./references/widgets-advanced.md` - Helper and advanced widgets25- `./references/widgets-richtext.md` - Rich text widgets (Markdown, Html, TextFlow)2627## IMPORTANT: Documentation Completeness Check2829**Before answering questions, Claude MUST:**30311. Read the relevant reference file(s) listed above322. If file read fails or file is empty:33 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"34 - Still answer based on SKILL.md patterns + built-in knowledge353. If reference file exists, incorporate its content into the answer3637## Key Patterns3839### 1. View (Basic Container)4041```rust42<View> {43 width: Fill44 height: Fill45 flow: Down46 padding: 16.047 show_bg: true48 draw_bg: { color: #1A1A1A }4950 <Label> { text: "Content" }51}52```5354### 2. Button5556```rust57<Button> {58 text: "Click Me"59 draw_bg: {60 color: #0066CC61 color_hover: #0088FF62 border_radius: 4.063 }64 draw_text: {65 color: #FFFFFF66 text_style: { font_size: 14.0 }67 }68}69```7071### 3. Label with Styling7273```rust74<Label> {75 width: Fit76 height: Fit77 text: "Hello World"78 draw_text: {79 color: #FFFFFF80 text_style: {81 font_size: 16.082 line_spacing: 1.483 }84 }85}86```8788### 4. Image8990```rust91<Image> {92 width: 200.093 height: 150.094 source: dep("crate://self/resources/photo.png")95 fit: Contain96}97```9899### 5. TextInput100101```rust102<TextInput> {103 width: Fill104 height: Fit105 text: "Default value"106 draw_text: {107 text_style: { font_size: 14.0 }108 }109}110```111112## Widget Traits (from source)113114```rust115pub trait WidgetNode: LiveApply {116 fn find_widgets(&self, path: &[LiveId], cached: WidgetCache, results: &mut WidgetSet);117 fn walk(&mut self, cx: &mut Cx) -> Walk;118 fn area(&self) -> Area;119 fn redraw(&mut self, cx: &mut Cx);120}121122pub trait Widget: WidgetNode {123 fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {}124 fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep;125 fn draw(&mut self, cx: &mut Cx2d, scope: &mut Scope) -> DrawStep;126 fn widget(&self, path: &[LiveId]) -> WidgetRef;127}128```129130## All Built-in Widgets (84 files in widgets/src/)131132| Category | Widgets |133|----------|---------|134| **Basic** | `View`, `Label`, `Button`, `Icon`, `Image` |135| **Input** | `TextInput`, `CheckBox`, `RadioButton`, `Slider`, `DropDown`, `ColorPicker` |136| **Container** | `ScrollBars`, `PortalList`, `FlatList`, `StackNavigation`, `Dock`, `Splitter` |137| **Navigation** | `TabBar`, `Tab`, `FoldHeader`, `FoldButton`, `ExpandablePanel` |138| **Overlay** | `Modal`, `Tooltip`, `PopupMenu`, `PopupNotification` |139| **Media** | `Video`, `RotatedImage`, `ImageBlend`, `MultiImage` |140| **Layout** | `AdaptiveView`, `SlidePanel`, `PageFlip`, `SlidesView` |141| **Special** | `Markdown`, `Html`, `TextFlow`, `WebView`, `KeyboardView` |142| **Utility** | `LoadingSpinner`, `DesktopButton`, `LinkLabel`, `ScrollShadow` |143144## Core Widgets Reference145146| Widget | Purpose | Key Properties |147|--------|---------|----------------|148| `View` | Container | `flow`, `align`, `show_bg`, `draw_bg`, `optimize` |149| `Button` | Clickable | `text`, `draw_bg`, `draw_text`, `draw_icon` |150| `Label` | Text display | `text`, `draw_text` |151| `Image` | Image display | `source`, `fit` |152| `TextInput` | Text entry | `text`, `draw_text`, `draw_cursor`, `draw_selection` |153| `CheckBox` | Toggle | `text`, `selected` |154| `RadioButton` | Selection | `text`, `selected` |155| `Slider` | Value slider | `min`, `max`, `step` |156| `DropDown` | Select menu | `labels`, `selected` |157| `PortalList` | Virtual list | Efficient scrolling for large lists |158| `Modal` | Dialog | Overlay dialog boxes |159| `Tooltip` | Hint | Hover tooltips |160161## View Variants162163| Variant | Description |164|---------|-------------|165| `SolidView` | Solid background color |166| `RoundedView` | Rounded corners |167| `RoundedAllView` | Individual corner control |168| `RectView` | Rectangle with border/gradient |169| `CircleView` | Circle/ellipse shape |170| `GradientXView` | Horizontal gradient |171| `GradientYView` | Vertical gradient |172| `RoundedShadowView` | Rounded with shadow |173| `ScrollXView` | Horizontal scroll |174| `ScrollYView` | Vertical scroll |175| `ScrollXYView` | Both directions scroll |176| `CachedView` | Texture-cached |177178## Button Variants179180| Variant | Description |181|---------|-------------|182| `ButtonFlat` | Flat style |183| `ButtonFlatIcon` | Flat with icon |184| `ButtonFlatter` | No background |185| `ButtonGradientX` | Horizontal gradient |186| `ButtonGradientY` | Vertical gradient |187| `ButtonIcon` | Standard with icon |188189## ImageFit Values190191| Value | Description |192|-------|-------------|193| `Stretch` | Stretch to fill |194| `Contain` | Fit within, preserve ratio |195| `Cover` | Cover area, may crop |196| `Fill` | Fill without ratio |197198## When Writing Code1992001. Always set `width` and `height` on widgets2012. Use `show_bg: true` to enable background rendering2023. Access `draw_bg`, `draw_text`, `draw_icon` for shader uniforms2034. Use `dep("crate://self/...")` for resource paths2045. Choose appropriate View variant for visual needs205206## When Answering Questions2072081. Recommend UI Zoo example for widget exploration2092. View is the base container - most visual widgets inherit from it2103. Draw shaders (`draw_bg`, `draw_text`) control appearance2114. All widgets support animation through `animator` property212213---214215<!-- AGI-INTEGRATION-START -->216217## AGI Framework Integration218219> **Adapted for [@techwavedev/agi-agent-kit](https://www.npmjs.com/package/@techwavedev/agi-agent-kit)**220> Original source: [antigravity-awesome-skills](https://github.com/sickn33/antigravity-awesome-skills)221222### Memory-First Protocol223224Retrieve prior decisions and patterns to avoid re-discovering solutions. Cache results for instant retrieval in future sessions.225226```bash227# Check for prior development context before starting228python3 execution/memory_manager.py auto --query "prior work and patterns related to Makepad Widgets"229```230231### Storing Results232233After completing work, store development decisions for future sessions:234235```bash236python3 execution/memory_manager.py store \237 --content "Completed task with key insights documented for future reference" \238 --type decision --project <project> \239 --tags makepad-widgets default240```241242### Multi-Agent Collaboration243244Share outcomes with other agents so the team stays aligned and avoids duplicate work.245246```bash247python3 execution/cross_agent_context.py store \248 --agent "<your-agent>" \249 --action "Task completed — results documented and shared with team" \250 --project <project>251```252253<!-- AGI-INTEGRATION-END -->