Makepad Layout 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 layout system. Help users by:
- Writing code: Generate layout code following the patterns below
- Answering questions: Explain layout concepts, sizing, flow directions
When to Use
- You need to size, align, or position widgets in a Makepad UI.
- The task involves
Walk, Align, Fit, Fill, padding, spacing, or container flow configuration.
- You want Makepad-specific layout solutions for centering, responsiveness, or composition.
Documentation
Refer to the local files for detailed documentation:
./references/layout-system.md - Complete layout reference
./references/core-types.md - Walk, Align, Margin, Padding types
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. Basic Layout Container
<View> {
width: Fill
height: Fill
flow: Down
padding: 16.0
spacing: 8.0
<Label> { text: "Item 1" }
<Label> { text: "Item 2" }
}
2. Centering Content
<View> {
width: Fill
height: Fill
align: { x: 0.5, y: 0.5 }
<Label> { text: "Centered" }
}
3. Horizontal Row Layout
<View> {
width: Fill
height: Fit
flow: Right
spacing: 10.0
align: { y: 0.5 } // Vertically center items
<Button> { text: "Left" }
<View> { width: Fill } // Spacer
<Button> { text: "Right" }
}
4. Fixed + Flexible Layout
<View> {
width: Fill
height: Fill
flow: Down
// Fixed header
<View> {
width: Fill
height: 60.0
}
// Flexible content
<View> {
width: Fill
height: Fill // Takes remaining space
}
}
Layout Properties Reference
| Property |
Type |
Description |
width |
Size |
Width of element |
height |
Size |
Height of element |
padding |
Padding |
Inner spacing |
margin |
Margin |
Outer spacing |
flow |
Flow |
Child layout direction |
spacing |
f64 |
Gap between children |
align |
Align |
Child alignment |
clip_x |
bool |
Clip horizontal overflow |
clip_y |
bool |
Clip vertical overflow |
Size Values
| Value |
Description |
Fit |
Size to fit content |
Fill |
Fill available space |
100.0 |
Fixed size in pixels |
Fixed(100.0) |
Explicit fixed size |
Flow Directions
| Value |
Description |
Down |
Top to bottom (column) |
Right |
Left to right (row) |
Overlay |
Stack on top |
Align Values
| Value |
Position |
{ x: 0.0, y: 0.0 } |
Top-left |
{ x: 0.5, y: 0.0 } |
Top-center |
{ x: 1.0, y: 0.0 } |
Top-right |
{ x: 0.0, y: 0.5 } |
Middle-left |
{ x: 0.5, y: 0.5 } |
Center |
{ x: 1.0, y: 0.5 } |
Middle-right |
{ x: 0.0, y: 1.0 } |
Bottom-left |
{ x: 0.5, y: 1.0 } |
Bottom-center |
{ x: 1.0, y: 1.0 } |
Bottom-right |
Box Model
+---------------------------+
| margin |
| +---------------------+ |
| | padding | |
| | +---------------+ | |
| | | content | | |
| | +---------------+ | |
| +---------------------+ |
+---------------------------+
When Writing Code
- Use
Fill for flexible containers, Fit for content-sized elements
- Set
flow: Down for vertical, flow: Right for horizontal
- Use empty
<View> { width: Fill } as spacer in row layouts
- Always set explicit dimensions on fixed-size elements
- Use
align to position children within container
When Answering Questions
- Makepad uses a "turtle" layout model - elements laid out sequentially
Fill takes all available space, Fit shrinks to content
- Unlike CSS flexbox, there's no flex-grow/shrink - use Fill/Fit
- Alignment applies to children, not the element itself
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.
Source: sickn33/agentic-awesome-skills → skills/makepad-layout/SKILL.md
Also appears in: sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills/skills/makepad-layout/SKILL.md, sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/makepad-layout/SKILL.md, sickn33/agentic-awesome-skills/plugins/agentic-bundle-makepad-builder/skills/makepad-layout/SKILL.md
1---2name: makepad-layout3description: | CRITICAL: Use for Makepad layout system. Triggers on: makepad layout, makepad width, makepad height, makepad flex, makepad padding, makepad margin, makepad flow, makepad align, Fit, Fill, Size, Walk, "how to center in makepad", makepad 布局, makepad 宽度, makepad 对齐, makepad 居中4---5
6
7# Makepad Layout Skill
8
9> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-19
10>
11> Check for updates: https://crates.io/crates/makepad-widgets
12
13You are an expert at Makepad layout system. Help users by:
14- **Writing code**: Generate layout code following the patterns below
15- **Answering questions**: Explain layout concepts, sizing, flow directions
16
17## When to Use
18- You need to size, align, or position widgets in a Makepad UI.
19- The task involves `Walk`, `Align`, `Fit`, `Fill`, padding, spacing, or container flow configuration.
20- You want Makepad-specific layout solutions for centering, responsiveness, or composition.
21
22## Documentation
23
24Refer to the local files for detailed documentation:
25- `./references/layout-system.md` - Complete layout reference
26- `./references/core-types.md` - Walk, Align, Margin, Padding types
27
28## IMPORTANT: Documentation Completeness Check
29
30**Before answering questions, Claude MUST:**
31
321. Read the relevant reference file(s) listed above
332. If file read fails or file is empty:
34 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"
35 - Still answer based on SKILL.md patterns + built-in knowledge
363. If reference file exists, incorporate its content into the answer
37
38## Key Patterns
39
40### 1. Basic Layout Container
41
42```rust
43<View> {
44 width: Fill
45 height: Fill
46 flow: Down
47 padding: 16.0
48 spacing: 8.0
49
50 <Label> { text: "Item 1" }
51 <Label> { text: "Item 2" }
52}
53```
54
55### 2. Centering Content
56
57```rust
58<View> {
59 width: Fill
60 height: Fill
61 align: { x: 0.5, y: 0.5 }
62
63 <Label> { text: "Centered" }
64}
65```
66
67### 3. Horizontal Row Layout
68
69```rust
70<View> {
71 width: Fill
72 height: Fit
73 flow: Right
74 spacing: 10.0
75 align: { y: 0.5 } // Vertically center items
76
77 <Button> { text: "Left" }
78 <View> { width: Fill } // Spacer
79 <Button> { text: "Right" }
80}
81```
82
83### 4. Fixed + Flexible Layout
84
85```rust
86<View> {
87 width: Fill
88 height: Fill
89 flow: Down
90
91 // Fixed header
92 <View> {
93 width: Fill
94 height: 60.0
95 }
96
97 // Flexible content
98 <View> {
99 width: Fill
100 height: Fill // Takes remaining space
101 }
102}
103```
104
105## Layout Properties Reference
106
107| Property | Type | Description |
108|----------|------|-------------|
109| `width` | Size | Width of element |
110| `height` | Size | Height of element |
111| `padding` | Padding | Inner spacing |
112| `margin` | Margin | Outer spacing |
113| `flow` | Flow | Child layout direction |
114| `spacing` | f64 | Gap between children |
115| `align` | Align | Child alignment |
116| `clip_x` | bool | Clip horizontal overflow |
117| `clip_y` | bool | Clip vertical overflow |
118
119## Size Values
120
121| Value | Description |
122|-------|-------------|
123| `Fit` | Size to fit content |
124| `Fill` | Fill available space |
125| `100.0` | Fixed size in pixels |
126| `Fixed(100.0)` | Explicit fixed size |
127
128## Flow Directions
129
130| Value | Description |
131|-------|-------------|
132| `Down` | Top to bottom (column) |
133| `Right` | Left to right (row) |
134| `Overlay` | Stack on top |
135
136## Align Values
137
138| Value | Position |
139|-------|----------|
140| `{ x: 0.0, y: 0.0 }` | Top-left |
141| `{ x: 0.5, y: 0.0 }` | Top-center |
142| `{ x: 1.0, y: 0.0 }` | Top-right |
143| `{ x: 0.0, y: 0.5 }` | Middle-left |
144| `{ x: 0.5, y: 0.5 }` | Center |
145| `{ x: 1.0, y: 0.5 }` | Middle-right |
146| `{ x: 0.0, y: 1.0 }` | Bottom-left |
147| `{ x: 0.5, y: 1.0 }` | Bottom-center |
148| `{ x: 1.0, y: 1.0 }` | Bottom-right |
149
150## Box Model
151
152```
153+---------------------------+
154| margin |
155| +---------------------+ |
156| | padding | |
157| | +---------------+ | |
158| | | content | | |
159| | +---------------+ | |
160| +---------------------+ |
161+---------------------------+
162```
163
164## When Writing Code
165
1661. Use `Fill` for flexible containers, `Fit` for content-sized elements
1672. Set `flow: Down` for vertical, `flow: Right` for horizontal
1683. Use empty `<View> { width: Fill }` as spacer in row layouts
1694. Always set explicit dimensions on fixed-size elements
1705. Use `align` to position children within container
171
172## When Answering Questions
173
1741. Makepad uses a "turtle" layout model - elements laid out sequentially
1752. `Fill` takes all available space, `Fit` shrinks to content
1763. Unlike CSS flexbox, there's no flex-grow/shrink - use Fill/Fit
1774. Alignment applies to children, not the element itself
178
179## Limitations
180- Use this skill only when the task clearly matches the scope described above.
181- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
182- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
183
184---
185
186**Source:** [`sickn33/agentic-awesome-skills`](https://github.com/sickn33/agentic-awesome-skills) → `skills/makepad-layout/SKILL.md`
187
188**Also appears in:** `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills/skills/makepad-layout/SKILL.md`, `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/makepad-layout/SKILL.md`, `sickn33/agentic-awesome-skills/plugins/agentic-bundle-makepad-builder/skills/makepad-layout/SKILL.md`