<script setup lang="ts">
import Card from '~/components/ui/Card.vue'
import Alert from '~/components/ui/Alert.vue'
import Layout from '~/components/ui/Layout.vue'
import Tab from '~/components/ui/Tab.vue'
import Tabs from '~/components/ui/Tabs.vue'
</script>

# Layout

The following containers are responsive. Change your window's size or select a device preset from your browser's dev tools to see how layouts are affected by available space.

<Tabs>
<Tab title="Flex (default)" icon="⠖">

Items are laid out in a row and wrapped as they overflow the container.
By default, all items in a row assume the same (maximum) height.

```vue-html
<Layout flex>
  <Card title="A" style="width:100px; min-width:100px"></Card>
  <Card title="B" :tags="['funk', 'dunk', 'punk']"></Card>
  <Card title="C" style="width:100px; min-width:100px"></Card>
  <Card title="D"></Card>
</Layout>
```

<div class="preview">
<Layout flex>
  <Card title="A" style="width:100px; min-width:100px"></Card>
  <Card title="B" :tags="['funk', 'dunk', 'punk']"></Card>
  <Card title="C" style="width:100px; min-width:100px"></Card>
  <Card title="D"></Card>
</Layout>
</div>

::: info Use additional `flexbox` properties

Find a list of all styles here: [Flexbox guide on css-tricks.com](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)

<Layout flex>
  <div class="preview" style="font-size:11px; font-weight:bold; mix-blend-mode:luminosity;">
    <Layout flex style="--gap: 4px;"> --gap: 4px
      <Alert style="align-self: flex-end">align-self: flex-end</Alert>
      <Alert style="flex-grow: 1">flex-grow: 1</Alert>
      <Alert style="height: 5rem;">height: 5rem</Alert>
      <Alert style="width: 100%">width: 100%</Alert>
    </Layout>
  </div>
</Layout>

:::

</Tab>
<Tab title="Grid" icon="ꖛ">

Align items both vertically and horizontally

##### Override the `:column-width` (in px):

<Layout flex>

```vue-html{1}
<Layout grid :column-width=90>
  <Alert>A</Alert>
  <Alert>B</Alert>
  ...
</Layout>
```

<div class="preview">
<Layout grid :column-width=90>
  <Alert>A</Alert>
  <Alert>B</Alert>
  <Alert>C</Alert>
  <Alert>D</Alert>
  <Alert>E</Alert>
  <Alert>F</Alert>
  <Alert>G</Alert>
</Layout>
</div>

</Layout>

##### Let elements span multiple rows or columns:

```vue-html{2,4}
<Layout grid>
  <Card title="A" class="span-2-columns"></Card>
  <Card title="B"></Card>
  <Card title="C" class="span-2-rows"></Card>
  <Card title="D"></Card>
</Layout>
```

<Layout grid>
  <Card title="A" class="span-2-columns">

    ```vue
    <Card class="span-2-columns"></Card>
    ```

  </Card>
  <Card title="B"></Card>
  <Card title="C" class="span-2-rows">

    ```vue
    <Card class="span-2-rows"></Card>
    ```

  </Card>
  <Card title="D"></Card>
</Layout>

</Tab>

<Tab title="Stack" icon="𝌆">

Add space between vertically stacked items

<Layout flex>

```vue-html
<Layout stack>
  <Card title="A"></Card>
  <Card title="B"></Card>
  <Card title="C"></Card>
  <Card title="D"></Card>
  <Card title="E"></Card>
</Layout>
```

<div class="preview">
<Layout stack>
  <Card title="A"></Card>
  <Card title="B"></Card>
  <Card title="C"></Card>
  <Card title="D"></Card>
  <Card title="E"></Card>
</Layout>
</div>

</Layout>

</Tab>

</Tabs>
