本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)48k · #5142

makepad-2-0-layout

できること

このエージェントは、Makepadで作ったアプリケーションのビジュアル要素の配置(レイアウト)を手助けします。'layout turtle'と呼ばれる仕組みを使って、コンポーネントが自分のサイズをどう決めるか、互いにどう配置されるかを説明します。

使う場面

  • ✓Makepadアプリのビジュアルインターフェースを作成するとき。
  • ✓画面の要素が期待どおりに表示されないとき。
  • ✓コンポーネントに適切な大きさのスペースを占めさせたいとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/makepad-2-0-layout/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/makepad-2-0-layout/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“テキストを利用可能な幅いっぱいに広げつつ、500ピクセルを超えないようにするには、どうすればよいですか?”

毎週5つの新しいスキル。1分で読めます。

仕組み

'layout turtle'の仕組みを使います。これは、コンポーネントが自分のサイズをどう決めるか('walk')と、コンテナが子要素をどう配置するか('layout')を定義するものです。'width'、'height'、'flow'、'spacing'などのプロパティを設定して、見た目を制御します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Limitations

  • Verify against current Makepad 2.0 docs; upstream APIs change frequently.
  • Do not run bundled scripts without explicit user approval.

When to Use

  • Use when this upstream workflow matches the user's stated goal.
  • Use when the task requires the procedures documented in this skill.

Makepad 2.0 Layout System

Makepad uses a layout turtle system -- not CSS flexbox, not CSS grid. The turtle walks through children one by one, placing each widget according to two core concepts:

  • Walk -- how a widget sizes itself (width, height, margin)
  • Layout -- how a container arranges its children (flow, spacing, padding, align)

Every container widget (View, SolidView, RoundedView, ScrollYView, etc.) has both Walk properties (its own size) and Layout properties (how it lays out children).


Walk System (Widget Sizing)

Walk controls how an individual widget claims space inside its parent.

width / height

Syntax Meaning
width: Fill Fill all remaining horizontal space (default)
width: Fit Shrink to fit content
width: 200 Fixed 200 pixels
width: Fill{min: 100 max: 500} Fill with constraints
width: Fit{max: Abs(300)} Fit content, capped at 300px
height: Fill Fill all remaining vertical space (default)
height: Fit Shrink to fit content
height: 100 Fixed 100 pixels
use mod.prelude.widgets.*

// Fill: takes all available width
View{
    width: Fill height: Fit
    flow: Down
    Label{text: "I stretch to fill the width"}
}

// Fit: shrinks to content
View{
    width: Fit height: Fit
    padding: 10
    Label{text: "I am only as wide as this text"}
}

// Fixed: exact pixel size
View{
    width: 300 height: 200
    Label{text: "I am exactly 300x200 pixels"}
}

// Constrained Fill: fills but within bounds
View{
    width: Fill{min: 200 max: 600} height: Fit
    flow: Down padding: 16
    Label{text: "I fill available space but stay between 200-600px"}
}

CRITICAL: height: Fit on Containers

This is the number one layout bug in Makepad.

The default height is Fill. When your output renders inside a Fit container, Fill inside Fit creates a circular dependency and resolves to 0 pixels. Your entire UI becomes invisible.

Rule: ALWAYS set height: Fit on every View, SolidView, RoundedView, and similar container unless the parent has a fixed or Fill height.

// CORRECT -- height: Fit makes the container visible
View{
    width: Fill height: Fit
    flow: Down padding: 10
    Label{text: "I am visible"}
}

// WRONG -- defaults to height: Fill, resolves to 0px, invisible
View{
    width: Fill
    flow: Down padding: 10
    Label{text: "I am invisible (0px tall)"}
}

Exceptions where height: Fill is acceptable:

  1. Inside a fixed-height parent:
View{
    height: 400
    View{
        height: Fill
        Label{text: "I fill the 400px parent"}
    }
}
  1. Inside a height: Fill chain that ultimately reaches a known size (e.g., Window body).
  2. ScrollYView always uses height: Fill because it must fill its parent to scroll.

margin

Margin adds space around the outside of a widget.

// Uniform margin on all sides
Label{text: "Hello" margin: 10}

// Selective margin with Inset
Label{
    text: "Indented"
    margin: Inset{top: 5 bottom: 5 left: 20 right: 20}
}

// Zero margin (note the trailing dot for float literal)
Label{text: "Flush" margin: 0.}

Layout System (Child Arrangement)

Layout controls how a container positions its children.

flow (Direction)

Syntax Meaning CSS Equivalent
flow: Right Left-to-right, single line (default) flex-direction: row
flow: Down Top-to-bottom, single column flex-direction: column
flow: Overlay Stack children on top of each other position: absolute stacking
flow: Flow.Right{wrap: true} Left-to-right with wrapping flex-wrap: wrap
flow: Flow.Down{wrap: true} Top-to-bottom with wrapping column wrap
use mod.prelude.widgets.*

// Vertical stack (most common)
View{
    width: Fill height: Fit
    flow: Down spacing: 10
    Label{text: "First"}
    Label{text: "Second"}
    Label{text: "Third"}
}

// Horizontal row
View{
    width: Fill height: Fit
    flow: Right spacing: 10
    Label{text: "Left"}
    Label{text: "Center"}
    Label{text: "Right"}
}

// Overlay -- children stacked on top of each other

…
よくある質問

UIが消えてしまうのはなぜですか?

親コンテナに高さが定義されていないのに、'height: Fit'のコンテナの中に'height: Fill'の要素を置くと、よく起こります。ルールは、親に高さが定義されていない限り、コンテナには'height: Fit'を使うことです。

'Walk'と'Layout'の違いは何ですか?

'Walk'は1つのコンポーネントのサイズ(幅や高さ)を定義します。'Layout'は、コンテナの中のコンポーネントの配置方法(方向、間隔、そろえ方)を定義します。

要素を縦に並べるにはどうすればよいですか?

要素を入れるコンテナ内で`flow: Down`を使います。また、`spacing`プロパティで要素同士の間隔を調整できます。

詳細

作者による元の説明

Makepad 2.0 guidance for layout; use when building or debugging Makepad UI code.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#5142
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル