# Makepad Layout

> |

- **Type:** Skill
- **Install:** `agentstack add skill-sagev1-makepad-skills-makepad-layout`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [SageV1](https://agentstack.voostack.com/s/sagev1)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [SageV1](https://github.com/SageV1)
- **Source:** https://github.com/SageV1/makepad-skills/tree/main/skills/makepad-layout
- **Website:** https://sagev1.github.io

## Install

```sh
agentstack add skill-sagev1-makepad-skills-makepad-layout
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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

## 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:**

1. Read the relevant reference file(s) listed above
2. 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
3. If reference file exists, incorporate its content into the answer

## Key Patterns

### 1. Basic Layout Container

```rust
 {
    width: Fill
    height: Fill
    flow: Down
    padding: 16.0
    spacing: 8.0

     { text: "Item 1" }
     { text: "Item 2" }
}
```

### 2. Centering Content

```rust
 {
    width: Fill
    height: Fill
    align: { x: 0.5, y: 0.5 }

     { text: "Centered" }
}
```

### 3. Horizontal Row Layout

```rust
 {
    width: Fill
    height: Fit
    flow: Right
    spacing: 10.0
    align: { y: 0.5 }  // Vertically center items

     { text: "Left" }
     { width: Fill }  // Spacer
     { text: "Right" }
}
```

### 4. Fixed + Flexible Layout

```rust
 {
    width: Fill
    height: Fill
    flow: Down

    // Fixed header
     {
        width: Fill
        height: 60.0
    }

    // Flexible content
     {
        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

1. Use `Fill` for flexible containers, `Fit` for content-sized elements
2. Set `flow: Down` for vertical, `flow: Right` for horizontal
3. Use empty ` { width: Fill }` as spacer in row layouts
4. Always set explicit dimensions on fixed-size elements
5. Use `align` to position children within container

## When Answering Questions

1. Makepad uses a "turtle" layout model - elements laid out sequentially
2. `Fill` takes all available space, `Fit` shrinks to content
3. Unlike CSS flexbox, there's no flex-grow/shrink - use Fill/Fit
4. Alignment applies to children, not the element itself

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [SageV1](https://github.com/SageV1)
- **Source:** [SageV1/makepad-skills](https://github.com/SageV1/makepad-skills)
- **License:** MIT
- **Homepage:** https://sagev1.github.io

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-sagev1-makepad-skills-makepad-layout
- Seller: https://agentstack.voostack.com/s/sagev1
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
