# `Slink.BlockKit`
[🔗](https://github.com/wkirschbaum/slink/blob/v0.6.0/lib/slink/block_kit.ex#L1)

Plain functions that build Block Kit maps — no DSL, no macros.

Hand-writing block maps is the most verbose part of any bot. These builders
return exactly the maps Slack expects, so they mix freely with hand-written
ones and drop straight into `reply/3`'s `blocks:` or a modal view:

    import Slink.BlockKit

    reply(context, "Ready to deploy?",
      blocks: [
        header("Deploy"),
        section("*prod* is 3 commits behind — ship it?"),
        actions([
          button("Deploy", action_id: "deploy", value: "prod", style: "primary"),
          button("Diff", action_id: "diff")
        ])
      ])

A modal for `open_modal/2`:

    modal("Settings", [
      input("Email", plain_text_input(action_id: "email")),
      input("Plan", static_select("Choose…", [option("Free", "free"), option("Pro", "pro")],
        action_id: "plan"))
    ], submit: "Save", callback_id: "settings")

Text defaults to `mrkdwn` where Slack allows it (sections, context) and
`plain_text` where Slack requires it (headers, buttons, titles). Every
builder takes only the common options; anything more exotic, write the map —
they compose.

# `actions`

An `actions` block holding interactive `elements` (buttons, selects…).

# `button`

A `button` element. `text` is plain text.

Options: `action_id:` (how the click arrives at your handler — see
`Slink.Event.action_id/1`), `value:` (rides along with the click),
`style:` (`"primary"` / `"danger"`), `url:`.

# `context`

A `context` block: small, muted text/images under a message.

`elements` is a list of strings (each becomes mrkdwn) or element maps.

# `divider`

A `divider` block.

# `header`

A `header` block. `text` is plain text (Slack requires it here).

# `image`

An `image` block. Options: `title:` (plain text), `block_id:`.

# `input`

An `input` block (for modals): a labelled form `element`.

Options: `optional:` (default `false`), `hint:` (plain text), `block_id:`.

# `modal`

A modal view for `Slink.open_modal/2` / `Slink.API.open_view/3`.

Options: `submit:` and `close:` (button labels, plain text),
`callback_id:` (how the submission arrives — see
`Slink.Event.callback_id/1`), `private_metadata:`.

# `mrkdwn`

A `mrkdwn` text object: `%{type: "mrkdwn", text: text}`.

# `option`

An option for a select menu: `option("Pro plan", "pro")`.

# `plain_text`

A `plain_text` text object. Option: `emoji:` (default `true`).

# `plain_text_input`

A `plain_text_input` element (for `input/3` blocks in modals).

Options: `action_id:`, `multiline:`, `placeholder:` (plain text),
`initial_value:`.

# `section`

A `section` block. `text` is mrkdwn (pass a text object to override).

Options: `fields:` (a list of strings — each becomes mrkdwn — or text
objects), `accessory:` (an element, e.g. a `button/2`), `block_id:`.

# `static_select`

A `static_select` menu. Build `options` with `option/2`.

Options: `action_id:`, `initial_option:`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
