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: 'CRITICAL: Use for Makepad layout system. Triggers on:45 makepad layout, makepad width, makepad height, makepad flex,67 makepad padding, makepad margin, makepad flow, makepad align,89 Fit, Fill, Size, Walk, "how to center in makepad",1011 makepad 布局, makepad 宽度, makepad 对齐, makepad 居中1213 '14metadata:15 source: https://skillmd.com/skills/iradoweck/makepad-layout16 aas-risk: safe17 aas-source: community18---1920# Makepad Layout 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 layout system. Help users by:27- **Writing code**: Generate layout code following the patterns below28- **Answering questions**: Explain layout concepts, sizing, flow directions2930## When to Use31- You need to size, align, or position widgets in a Makepad UI.32- The task involves `Walk`, `Align`, `Fit`, `Fill`, padding, spacing, or container flow configuration.33- You want Makepad-specific layout solutions for centering, responsiveness, or composition.3435## Documentation3637Refer to the local files for detailed documentation:38- `./references/layout-system.md` - Complete layout reference39- `./references/core-types.md` - Walk, Align, Margin, Padding types4041## IMPORTANT: Documentation Completeness Check4243**Before answering questions, Claude MUST:**44451. Read the relevant reference file(s) listed above462. If file read fails or file is empty:47 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"48 - Still answer based on SKILL.md patterns + built-in knowledge493. If reference file exists, incorporate its content into the answer5051## Key Patterns5253### 1. Basic Layout Container5455```rust56<View> {57 width: Fill58 height: Fill59 flow: Down60 padding: 16.061 spacing: 8.06263 <Label> { text: "Item 1" }64 <Label> { text: "Item 2" }65}66```6768### 2. Centering Content6970```rust71<View> {72 width: Fill73 height: Fill74 align: { x: 0.5, y: 0.5 }7576 <Label> { text: "Centered" }77}78```7980### 3. Horizontal Row Layout8182```rust83<View> {84 width: Fill85 height: Fit86 flow: Right87 spacing: 10.088 align: { y: 0.5 } // Vertically center items8990 <Button> { text: "Left" }91 <View> { width: Fill } // Spacer92 <Button> { text: "Right" }93}94```9596### 4. Fixed + Flexible Layout9798```rust99<View> {100 width: Fill101 height: Fill102 flow: Down103104 // Fixed header105 <View> {106 width: Fill107 height: 60.0108 }109110 // Flexible content111 <View> {112 width: Fill113 height: Fill // Takes remaining space114 }115}116```117118## Layout Properties Reference119120| Property | Type | Description |121|----------|------|-------------|122| `width` | Size | Width of element |123| `height` | Size | Height of element |124| `padding` | Padding | Inner spacing |125| `margin` | Margin | Outer spacing |126| `flow` | Flow | Child layout direction |127| `spacing` | f64 | Gap between children |128| `align` | Align | Child alignment |129| `clip_x` | bool | Clip horizontal overflow |130| `clip_y` | bool | Clip vertical overflow |131132## Size Values133134| Value | Description |135|-------|-------------|136| `Fit` | Size to fit content |137| `Fill` | Fill available space |138| `100.0` | Fixed size in pixels |139| `Fixed(100.0)` | Explicit fixed size |140141## Flow Directions142143| Value | Description |144|-------|-------------|145| `Down` | Top to bottom (column) |146| `Right` | Left to right (row) |147| `Overlay` | Stack on top |148149## Align Values150151| Value | Position |152|-------|----------|153| `{ x: 0.0, y: 0.0 }` | Top-left |154| `{ x: 0.5, y: 0.0 }` | Top-center |155| `{ x: 1.0, y: 0.0 }` | Top-right |156| `{ x: 0.0, y: 0.5 }` | Middle-left |157| `{ x: 0.5, y: 0.5 }` | Center |158| `{ x: 1.0, y: 0.5 }` | Middle-right |159| `{ x: 0.0, y: 1.0 }` | Bottom-left |160| `{ x: 0.5, y: 1.0 }` | Bottom-center |161| `{ x: 1.0, y: 1.0 }` | Bottom-right |162163## Box Model164165```166+---------------------------+167| margin |168| +---------------------+ |169| | padding | |170| | +---------------+ | |171| | | content | | |172| | +---------------+ | |173| +---------------------+ |174+---------------------------+175```176177## When Writing Code1781791. Use `Fill` for flexible containers, `Fit` for content-sized elements1802. Set `flow: Down` for vertical, `flow: Right` for horizontal1813. Use empty `<View> { width: Fill }` as spacer in row layouts1824. Always set explicit dimensions on fixed-size elements1835. Use `align` to position children within container184185## When Answering Questions1861871. Makepad uses a "turtle" layout model - elements laid out sequentially1882. `Fill` takes all available space, `Fit` shrinks to content1893. Unlike CSS flexbox, there's no flex-grow/shrink - use Fill/Fit1904. Alignment applies to children, not the element itself191192## Limitations193- Use this skill only when the task clearly matches the scope described above.194- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.195- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.