{"route":"/en-US-v0.14.1/reference/layout/stack/","title":"Stack","description":"Documentation for the `stack` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"example","name":"Example","children":[]},{"id":"accessibility","name":"Accessibility","children":[]},{"id":"parameters","name":"Parameters","children":[{"id":"parameters-dir","name":"dir","children":[]},{"id":"parameters-spacing","name":"spacing","children":[]},{"id":"parameters-children","name":"children","children":[]}]}],"body":{"kind":"func","content":{"path":[],"name":"stack","title":"Stack","keywords":[],"oneliner":"Arranges content and spacing horizontally or vertically.","element":true,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Arranges content and spacing horizontally or vertically.</p>\n<p>The stack places a list of items along an axis, with optional spacing\nbetween each item.</p>\n<h2 id=\"example\">Example</h2>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">stack</span><span class=\"typ-punct\">(</span>\n  dir<span class=\"typ-punct\">:</span> ttb<span class=\"typ-punct\">,</span>\n  <span class=\"typ-func\">rect</span><span class=\"typ-punct\">(</span>width<span class=\"typ-punct\">:</span> <span class=\"typ-num\">40pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-func\">rect</span><span class=\"typ-punct\">(</span>width<span class=\"typ-punct\">:</span> <span class=\"typ-num\">120pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-func\">rect</span><span class=\"typ-punct\">(</span>width<span class=\"typ-punct\">:</span> <span class=\"typ-num\">90pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/adb95cfe03b8a39a9210f26d5c3d6a3e.png\" alt=\"Preview\"></div></div>\n<h2 id=\"accessibility\">Accessibility</h2>\n<p>Stacks do not carry any special semantics. The contents of the stack are\nread by Assistive Technology (AT) in the order in which they have been\npassed to this function.</p>"}],"self":false,"params":[{"name":"dir","details":[{"kind":"html","content":"<p>The direction along which the items are stacked. Possible values are:</p>\n<ul>\n<li><code>ltr</code>: Left to right.</li>\n<li><code>rtl</code>: Right to left.</li>\n<li><code>ttb</code>: Top to bottom.</li>\n<li><code>btt</code>: Bottom to top.</li>\n</ul>\n<p>You can use the <code>start</code> and <code>end</code> methods to obtain the initial and\nfinal points (respectively) of a direction, as <code>alignment</code>. You can also\nuse the <code>axis</code> method to determine whether a direction is\n<code><span class=\"typ-str\">&quot;horizontal&quot;</span></code> or <code><span class=\"typ-str\">&quot;vertical&quot;</span></code>. The <code>inv</code> method returns a\ndirection's inverse direction.</p>\n<p>For example, <code>ttb<span class=\"typ-punct\">.</span><span class=\"typ-func\">start</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span></code> is <code>top</code>, <code>ttb<span class=\"typ-punct\">.</span><span class=\"typ-func\">end</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span></code> is <code>bottom</code>,\n<code>ttb<span class=\"typ-punct\">.</span><span class=\"typ-func\">axis</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span></code> is <code><span class=\"typ-str\">&quot;vertical&quot;</span></code> and <code>ttb<span class=\"typ-punct\">.</span><span class=\"typ-func\">inv</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span></code> is equal to <code>btt</code>.</p>"}],"types":["direction"],"strings":[],"default":"<code>ttb</code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"spacing","details":[{"kind":"html","content":"<p>Spacing to insert between items where no explicit spacing was provided.</p>"}],"types":["none","relative","fraction"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"children","details":[{"kind":"html","content":"<p>The children to stack along the axis.</p>"}],"types":["relative","fraction","content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":true,"settable":false}],"returns":["content"],"scope":[]}}}