ExPlain.Components (ExPlain v0.3.0)

Copy Markdown View Source

Builders for ComponentInput values used in thread and event creation.

Components are the building blocks of thread messages and custom timeline entries. Each function returns a map shaped as ComponentInput in the Plain GraphQL schema.

Example

components = [
  ExPlain.Components.text("## Bug report"),
  ExPlain.Components.plain_text("Steps to reproduce:"),
  ExPlain.Components.plain_text("1. Visit /login\n2. Enter credentials"),
  ExPlain.Components.divider(),
  ExPlain.Components.badge("High priority", color: :red)
]

Summary

Functions

A badge/pill label.

A container for grouping components.

A copy-to-clipboard button.

A horizontal divider.

A link button.

A plain (non-markdown) text block.

A two-column row. Each cell should be a list of components.

A vertical spacer.

A markdown text block.

Types

component()

@type component() :: map()

Functions

badge(label, opts \\ [])

@spec badge(
  String.t(),
  keyword()
) :: component()

A badge/pill label.

Options

  • :color - :green, :yellow, :red, :blue, or :grey

container(content)

@spec container([component()]) :: component()

A container for grouping components.

copy_button(value, opts \\ [])

@spec copy_button(
  String.t(),
  keyword()
) :: component()

A copy-to-clipboard button.

divider(opts \\ [])

@spec divider(keyword()) :: component()

A horizontal divider.

Options

  • :spacing_size - :xs, :s, :m (default), :l, or :xl

plain_text(text, opts \\ [])

@spec plain_text(
  String.t(),
  keyword()
) :: component()

A plain (non-markdown) text block.

Options

  • :size - :xs, :s, :m (default), or :l
  • :color - :normal (default), :muted, :success, :warning, or :error

row(opts)

@spec row(keyword()) :: component()

A two-column row. Each cell should be a list of components.

spacer(size \\ :m)

@spec spacer(atom()) :: component()

A vertical spacer.

text(markdown_text)

@spec text(String.t()) :: component()

A markdown text block.