> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stac.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Column

> Documentation for Column

export const PLAYGROUND_BASE_URL = "https://playground.stac.dev/";

export const columnPreviewJson = {
  "type": "column",
  "mainAxisAlignment": "center",
  "crossAxisAlignment": "start",
  "mainAxisSize": "min",
  "textDirection": "ltr",
  "verticalDirection": "up",
  "spacing": 10,
  "children": [{
    "type": "text",
    "data": "Hello, World!"
  }, {
    "type": "container",
    "width": 100,
    "height": 100,
    "color": "#FF0000"
  }]
};
export const columnPreviewSrc = `${PLAYGROUND_BASE_URL}/embed`;

The Stac Column allows you to build a Flutter column widget using JSON.
To know more about the column widget in Flutter, refer to the [official documentation](https://api.flutter.dev/flutter/widgets/Column-class.html).

## Properties

| Property           | Type                     | Description                                                                                      |
| ------------------ | ------------------------ | ------------------------------------------------------------------------------------------------ |
| mainAxisAlignment  | `StacMainAxisAlignment`  | How the children should be placed along the main axis. Defaults to `MainAxisAlignment.start`.    |
| crossAxisAlignment | `StacCrossAxisAlignment` | How the children should be placed along the cross axis. Defaults to `CrossAxisAlignment.center`. |
| mainAxisSize       | `StacMainAxisSize`       | How much space should be occupied in the main axis. Defaults to `MainAxisSize.max`.              |
| textDirection      | `StacTextDirection`      | The text direction to use for resolving alignment.                                               |
| verticalDirection  | `StacVerticalDirection`  | The vertical direction to use for laying out children. Defaults to `VerticalDirection.down`.     |
| textBaseline       | `StacTextBaseline`       | The baseline to use for aligning text.                                                           |
| spacing            | `double`                 | The spacing between children. Defaults to `0`.                                                   |
| children           | `List<StacWidget>`       | The list of widgets to display inside the column. Defaults to an empty list.                     |

## Example

<Tabs sync={false}>
  <Tab title="Dart">
    ```dart theme={null}
    StacColumn(
      mainAxisAlignment: StacMainAxisAlignment.center,
      crossAxisAlignment: StacCrossAxisAlignment.start,
      mainAxisSize: StacMainAxisSize.min,
      textDirection: StacTextDirection.ltr,
      verticalDirection: StacVerticalDirection.up,
      spacing: 10,
      children: [
        StacText(data: 'Hello, World!'),
        StacContainer(
          width: 100,
          height: 100,
          color: StacColors.red,
        ),
      ],
    )
    ```
  </Tab>

  <Tab title="JSON">
    ```json theme={null}
    {
      "type": "column",
      "mainAxisAlignment": "center",
      "crossAxisAlignment": "start",
      "mainAxisSize": "min",
      "textDirection": "ltr",
      "verticalDirection": "up",
      "spacing": 10,
      "children": [
        {
          "type": "text",
          "data": "Hello, World!"
        },
        {
          "type": "container",
          "width": 100,
          "height": 100,
          "color": "#FF0000"
        }
      ]
    }
    ```
  </Tab>

  <Tab title="Preview">
    <Frame>
      <iframe
        id="stac"
        src={columnPreviewSrc}
        title="Stac Playground"
        className="w-full rounded-xl border-0"
        style={{ height: "640px" }}
        loading="lazy"
        onLoad={(event) => {
      const iframe = event.currentTarget;
      const targetOrigin = PLAYGROUND_BASE_URL;
      const message = {
        type: "stac-preview-json",
        payload: columnPreviewJson
      };

      let attempts = 0;
      const maxAttempts = 12;
      const interval = setInterval(() => {
        iframe.contentWindow?.postMessage(message, targetOrigin);
        attempts += 1;

        if (attempts >= maxAttempts) {
          clearInterval(interval);
        }
      }, 250);
    }}
      />
    </Frame>
  </Tab>
</Tabs>
