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.
1---2name: makepad-layout3description: |4 CRITICAL: Use for Makepad layout system. Triggers on:5 makepad layout, makepad width, makepad height, makepad flex,6 makepad padding, makepad margin, makepad flow, makepad align,7 Fit, Fill, Size, Walk, "how to center in makepad",8 makepad 布局, makepad 宽度, makepad 对齐, makepad 居中9risk: safe10source: community11metadata:12 source: https://skillmd.com/skills/mhassan0000/makepad-layout13---1415# Makepad Layout Skill1617> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-1918>19> Check for updates: https://crates.io/crates/makepad-widgets2021You are an expert at Makepad layout system. Help users by:22- **Writing code**: Generate layout code following the patterns below23- **Answering questions**: Explain layout concepts, sizing, flow directions2425## When to Use26- You need to size, align, or position widgets in a Makepad UI.27- The task involves `Walk`, `Align`, `Fit`, `Fill`, padding, spacing, or container flow configuration.28- You want Makepad-specific layout solutions for centering, responsiveness, or composition.2930## Documentation3132Refer to the local files for detailed documentation:33- `./references/layout-system.md` - Complete layout reference34- `./references/core-types.md` - Walk, Align, Margin, Padding types3536## IMPORTANT: Documentation Completeness Check3738**Before answering questions, Claude MUST:**39401. Read the relevant reference file(s) listed above412. If file read fails or file is empty:42 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"43 - Still answer based on SKILL.md patterns + built-in knowledge443. If reference file exists, incorporate its content into the answer4546## Key Patterns4748### 1. Basic Layout Container4950```rust51<View> {52 width: Fill53 height: Fill54 flow: Down55 padding: 16.056 spacing: 8.05758 <Label> { text: "Item 1" }59 <Label> { text: "Item 2" }60}61```6263### 2. Centering Content6465```rust66<View> {67 width: Fill68 height: Fill69 align: { x: 0.5, y: 0.5 }7071 <Label> { text: "Centered" }72}73```7475### 3. Horizontal Row Layout7677```rust78<View> {79 width: Fill80 height: Fit81 flow: Right82 spacing: 10.083 align: { y: 0.5 } // Vertically center items8485 <Button> { text: "Left" }86 <View> { width: Fill } // Spacer87 <Button> { text: "Right" }88}89```9091### 4. Fixed + Flexible Layout9293```rust94<View> {95 width: Fill96 height: Fill97 flow: Down9899 // Fixed header100 <View> {101 width: Fill102 height: 60.0103 }104105 // Flexible content106 <View> {107 width: Fill108 height: Fill // Takes remaining space109 }110}111```112113## Layout Properties Reference114115| Property | Type | Description |116|----------|------|-------------|117| `width` | Size | Width of element |118| `height` | Size | Height of element |119| `padding` | Padding | Inner spacing |120| `margin` | Margin | Outer spacing |121| `flow` | Flow | Child layout direction |122| `spacing` | f64 | Gap between children |123| `align` | Align | Child alignment |124| `clip_x` | bool | Clip horizontal overflow |125| `clip_y` | bool | Clip vertical overflow |126127## Size Values128129| Value | Description |130|-------|-------------|131| `Fit` | Size to fit content |132| `Fill` | Fill available space |133| `100.0` | Fixed size in pixels |134| `Fixed(100.0)` | Explicit fixed size |135136## Flow Directions137138| Value | Description |139|-------|-------------|140| `Down` | Top to bottom (column) |141| `Right` | Left to right (row) |142| `Overlay` | Stack on top |143144## Align Values145146| Value | Position |147|-------|----------|148| `{ x: 0.0, y: 0.0 }` | Top-left |149| `{ x: 0.5, y: 0.0 }` | Top-center |150| `{ x: 1.0, y: 0.0 }` | Top-right |151| `{ x: 0.0, y: 0.5 }` | Middle-left |152| `{ x: 0.5, y: 0.5 }` | Center |153| `{ x: 1.0, y: 0.5 }` | Middle-right |154| `{ x: 0.0, y: 1.0 }` | Bottom-left |155| `{ x: 0.5, y: 1.0 }` | Bottom-center |156| `{ x: 1.0, y: 1.0 }` | Bottom-right |157158## Box Model159160```161+---------------------------+162| margin |163| +---------------------+ |164| | padding | |165| | +---------------+ | |166| | | content | | |167| | +---------------+ | |168| +---------------------+ |169+---------------------------+170```171172## When Writing Code1731741. Use `Fill` for flexible containers, `Fit` for content-sized elements1752. Set `flow: Down` for vertical, `flow: Right` for horizontal1763. Use empty `<View> { width: Fill }` as spacer in row layouts1774. Always set explicit dimensions on fixed-size elements1785. Use `align` to position children within container179180## When Answering Questions1811821. Makepad uses a "turtle" layout model - elements laid out sequentially1832. `Fill` takes all available space, `Fit` shrinks to content1843. Unlike CSS flexbox, there's no flex-grow/shrink - use Fill/Fit1854. Alignment applies to children, not the element itself186187## Limitations188- Use this skill only when the task clearly matches the scope described above.189- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.190- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.