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-widgets3description: "Version: makepad-widgets (dev branch) | Last Updated: 2026-01-19 > > Check for updates: https://crates.io/crates/makepad-widgets"4version: 1.0.05author:6 name: "sickn33 / Antigravity Community"7 github: sickn338tags: [makepad, widgets, development]9category: development10platforms: [macos, linux, windows]11license: MIT12metadata:13 hermes:14 source: https://skillmd.com/skills/nous-hermeshub/makepad-widgets15 upstream: "antigravity-awesome-skills"16 risk: "safe"17 original_author: "Antigravity Community"18---1920# Makepad Widgets Skill2122> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-1923>24> Check for updates: https://crates.io/crates/makepad-widgets2526You are an expert at Makepad widgets. Help users by:27- **Writing code**: Generate widget code following the patterns below28- **Answering questions**: Explain widget properties, variants, and usage2930## When to Use31- You need to work with core or advanced widgets in Makepad.32- The task involves widget selection, properties, variants, composition, or widget-specific behavior.33- You want examples for `View`, `Button`, labels, rich text, or other `makepad-widgets` building blocks.3435## Documentation3637Refer to the local files for detailed documentation:38- `./references/widgets-core.md` - Core widgets (View, Button, Label, etc.)39- `./references/widgets-advanced.md` - Helper and advanced widgets40- `./references/widgets-richtext.md` - Rich text widgets (Markdown, Html, TextFlow)4142## IMPORTANT: Documentation Completeness Check4344**Before answering questions, Claude MUST:**45461. Read the relevant reference file(s) listed above472. If file read fails or file is empty:48 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"49 - Still answer based on SKILL.md patterns + built-in knowledge503. If reference file exists, incorporate its content into the answer5152## Key Patterns5354### 1. View (Basic Container)5556```rust57<View> {58 width: Fill59 height: Fill60 flow: Down61 padding: 16.062 show_bg: true63 draw_bg: { color: #1A1A1A }6465 <Label> { text: "Content" }66}67```6869### 2. Button7071```rust72<Button> {73 text: "Click Me"74 draw_bg: {75 color: #0066CC76 color_hover: #0088FF77 border_radius: 4.078 }79 draw_text: {80 color: #FFFFFF81 text_style: { font_size: 14.0 }82 }83}84```8586### 3. Label with Styling8788```rust89<Label> {90 width: Fit91 height: Fit92 text: "Hello World"93 draw_text: {94 color: #FFFFFF95 text_style: {96 font_size: 16.097 line_spacing: 1.498 }99 }100}101```102103### 4. Image104105```rust106<Image> {107 width: 200.0108 height: 150.0109 source: dep("crate://self/resources/photo.png")110 fit: Contain111}112```113114### 5. TextInput115116```rust117<TextInput> {118 width: Fill119 height: Fit120 text: "Default value"121 draw_text: {122 text_style: { font_size: 14.0 }123 }124}125```126127## Widget Traits (from source)128129```rust130pub trait WidgetNode: LiveApply {131 fn find_widgets(&self, path: &[LiveId], cached: WidgetCache, results: &mut WidgetSet);132 fn walk(&mut self, cx: &mut Cx) -> Walk;133 fn area(&self) -> Area;134 fn redraw(&mut self, cx: &mut Cx);135}136137pub trait Widget: WidgetNode {138 fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {}139 fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep;140 fn draw(&mut self, cx: &mut Cx2d, scope: &mut Scope) -> DrawStep;141 fn widget(&self, path: &[LiveId]) -> WidgetRef;142}143```144145## All Built-in Widgets (84 files in widgets/src/)146147| Category | Widgets |148|----------|---------|149| **Basic** | `View`, `Label`, `Button`, `Icon`, `Image` |150| **Input** | `TextInput`, `CheckBox`, `RadioButton`, `Slider`, `DropDown`, `ColorPicker` |151| **Container** | `ScrollBars`, `PortalList`, `FlatList`, `StackNavigation`, `Dock`, `Splitter` |152| **Navigation** | `TabBar`, `Tab`, `FoldHeader`, `FoldButton`, `ExpandablePanel` |153| **Overlay** | `Modal`, `Tooltip`, `PopupMenu`, `PopupNotification` |154| **Media** | `Video`, `RotatedImage`, `ImageBlend`, `MultiImage` |155| **Layout** | `AdaptiveView`, `SlidePanel`, `PageFlip`, `SlidesView` |156| **Special** | `Markdown`, `Html`, `TextFlow`, `WebView`, `KeyboardView` |157| **Utility** | `LoadingSpinner`, `DesktopButton`, `LinkLabel`, `ScrollShadow` |158159## Core Widgets Reference160161| Widget | Purpose | Key Properties |162|--------|---------|----------------|163| `View` | Container | `flow`, `align`, `show_bg`, `draw_bg`, `optimize` |164| `Button` | Clickable | `text`, `draw_bg`, `draw_text`, `draw_icon` |165| `Label` | Text display | `text`, `draw_text` |166| `Image` | Image display | `source`, `fit` |167| `TextInput` | Text entry | `text`, `draw_text`, `draw_cursor`, `draw_selection` |168| `CheckBox` | Toggle | `text`, `selected` |169| `RadioButton` | Selection | `text`, `selected` |170| `Slider` | Value slider | `min`, `max`, `step` |171| `DropDown` | Select menu | `labels`, `selected` |172| `PortalList` | Virtual list | Efficient scrolling for large lists |173| `Modal` | Dialog | Overlay dialog boxes |174| `Tooltip` | Hint | Hover tooltips |175176## View Variants177178| Variant | Description |179|---------|-------------|180| `SolidView` | Solid background color |181| `RoundedView` | Rounded corners |182| `RoundedAllView` | Individual corner control |183| `RectView` | Rectangle with border/gradient |184| `CircleView` | Circle/ellipse shape |185| `GradientXView` | Horizontal gradient |186| `GradientYView` | Vertical gradient |187| `RoundedShadowView` | Rounded with shadow |188| `ScrollXView` | Horizontal scroll |189| `ScrollYView` | Vertical scroll |190| `ScrollXYView` | Both directions scroll |191| `CachedView` | Texture-cached |192193## Button Variants194195| Variant | Description |196|---------|-------------|197| `ButtonFlat` | Flat style |198| `ButtonFlatIcon` | Flat with icon |199| `ButtonFlatter` | No background |200| `ButtonGradientX` | Horizontal gradient |201| `ButtonGradientY` | Vertical gradient |202| `ButtonIcon` | Standard with icon |203204## ImageFit Values205206| Value | Description |207|-------|-------------|208| `Stretch` | Stretch to fill |209| `Contain` | Fit within, preserve ratio |210| `Cover` | Cover area, may crop |211| `Fill` | Fill without ratio |212213## When Writing Code2142151. Always set `width` and `height` on widgets2162. Use `show_bg: true` to enable background rendering2173. Access `draw_bg`, `draw_text`, `draw_icon` for shader uniforms2184. Use `dep("crate://self/...")` for resource paths2195. Choose appropriate View variant for visual needs220221## When Answering Questions2222231. Recommend UI Zoo example for widget exploration2242. View is the base container - most visual widgets inherit from it2253. Draw shaders (`draw_bg`, `draw_text`) control appearance2264. All widgets support animation through `animator` property227228## Limitations229- Use this skill only when the task clearly matches the scope described above.230- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.231- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.