# `IO.ANSI.Table.Options`
[🔗](https://github.com/RaymondLoranger/io_ansi_table/blob/main/lib/io/ansi/table/options.ex#L1)

Documents the options and table styles used in the `IO.ANSI.Table` API.

## Options

* `:align_specs` - to align column elements (list of
  [align specs](`t:IO.ANSI.Table.Header.align_spec/0`) where `:left` is the
  default [align attribute](`t:IO.ANSI.Table.Header.align_attr/0`)).
  Defaults to `[]`.

  ```elixir
  align_specs: [
    center: "station_id", right: "pressure_mb", right: "pressure_in"
  ]
  ```

  ```elixir
  align_specs: [left: "station_id", right: "wind_mph"]
  ```

  ```elixir
  align_specs: ["station_id", right: "wind_mph"]
  ```

* `:async` - whether to format the table asynchronously (boolean).
  Defaults to `false`.

* `:bell` - whether to ring the bell (boolean). Defaults to `false`.

* `:count` - number of [maps/keywords/structs](`t:Access.container/0`)
  to format (integer). Defaults to `11`.

  ```elixir
  count: 11 # first 11 sorted `maps`
  ```

  ```elixir
  count: -11 # last 11 sorted `maps`
  ```

* `:header_fixes` - to alter the [headers](`t:IO.ANSI.Table.Header.t/0`)
  once changed to "title case" (map). Defaults to %{}.

  ```elixir
  header_fixes: %{
    # "station_id" => "Station ID"
    ~r[ id$]i       => " ID",
    # "wind_mph" => "Wind MPH"
    ~r[ mph$]i      => " MPH",
    # "observation_time_rfc822" => "Observation Time RFC-822"
    ~r[ rfc(\d+)$]i => " RFC-\\1"
  }
  ```

  ```elixir
  header_fixes: %{
    " A "   => " a ",
    " An "  => " an ",
    " And " => " and ",
    " At "  => " at ",
    " But " => " but ",
    " By "  => " by ",
    " For " => " for ",
    " Not " => " not ",
    " Of "  => " of ",
    " On "  => " on ",
    " Or "  => " or ",
    " So "  => " so ",
    " The " => " the ",
    " To "  => " to ",
    " Yet " => " yet "
  }
  ```

* `:margins` - to position the table (keyword). Defaults to
  `[top: 1, bottom: 1, left: 2]`

  ```elixir
  margins: [ # default margins
    top:    1, # line(s) before table (can be negative)
    bottom: 1, # line(s) after table
    left:   2  # column(s) left of table
  ]
  ```

  ```elixir
  margins: [ # example of a side-by-side table
    top:    -11, # move cursor up 11 lines!!
    bottom:   1,
    left:    35, # move cursor forward 35 columns!!
  ]
  ```

* `:max_width` - to cap column widths (non neg integer). Defaults to `99`.

* `:sort_specs` - to sort the [maps/keywords/structs](`t:Access.container/0`)
  (list of [sort specs](`t:IO.ANSI.Table.Header.sort_spec/0`) where `:asc` is
  the default [sort attribute](`t:IO.ANSI.Table.Header.sort_attr/0`)).
  Defaults to `[]`.

  ```elixir
  sort_specs: ["station_id", "wind_mph"]
  ```

  ```elixir
  sort_specs: ["station_id", desc: "wind_mph", desc: "temp_c"]
  ```

  ```elixir
  sort_specs: [asc: "station_id", desc: "wind_mph"]
  ```

  ```elixir
  sort_specs: ["dept", desc: {"hired", Date}]
  ```

  ```elixir
  sort_specs: [{"hired", Date}, "job", {:desc, "dept"}]
  ```

  ```elixir
  sort_specs: [{"hired", Date}, desc: "dept"]
  ```

* `:sort_symbols` - to denote sort direction (keyword list of
  [sort symbols](`t:IO.ANSI.Table.Header.sort_symbol/0`)). Defaults to
  `[asc: "↑", desc: "↓", pos: :trailing]`.

  ```elixir
  sort_symbols: [asc: "↑", desc: "↓", pos: :trailing] # default sort symbols
  ```

  ```elixir
  sort_symbols: [asc: " ▲ ", desc: " ▼ ", pos: [:leading, :trailing]]
  ```

  ```elixir
  sort_symbols: [asc: "⬆", desc: "⬇", pos: :leading]
  ```

* `:spec_name` - to identify the table spec server (string). Defaults to the
  current application name expressed as a string.

* `:style` - table style (atom). Defaults to `:plain`.

  ```elixir
  style: :plain # default style
  ```

  ```elixir
  style: :dark
  ```
## Table styles

  - `:bare`                  - no colors
  - `:barish`                - like bare but colored
  - `:cyan`                  - cyan background
  - `:cyan_alt`              - cyan header, alternating row colors
  - `:cyan_border`           - light cyan border
  - `:cyan_mult`             - cyan header, 3 repeating row colors
  - `:dark`                  - dark colors
  - `:dark_alt`              - dark colors, alternating row colors
  - `:dark_mult`             - dark colors, 3 repeating row colors
  - `:dashed`                - no colors
  - `:dotted`                - slightly colored
  - `:dotted_alt`            - slightly colored, alternating row colors
  - `:dotted_mult`           - slightly colored, 3 repeating row colors
  - `:game`                  - game board
  - `:green`                 - green background
  - `:green_alt`             - green header, alternating row colors
  - `:green_border`          - light green border
  - `:green_border_padded`   - light green border with extra padding
  - `:green_border_unpadded` - light green border without padding
  - `:green_mult`            - green header, 3 repeating row colors
  - `:green_padded`          - like green but with extra padding
  - `:green_unpadded`        - like green but without padding
  - `:light`                 - light colors
  - `:light_alt`             - light colors, alternating row colors
  - `:light_mult`            - light colors, 3 repeating row colors
  - `:medium`                - medium colors
  - `:medium_alt`            - medium colors, alternating row colors
  - `:medium_mult`           - medium colors, 3 repeating row colors
  - `:mixed`                 - fillers revealed
  - `:plain`                 - slightly colored
  - `:pretty`                - multicolored
  - `:pretty_alt`            - multicolored, alternating row colors
  - `:pretty_mult`           - multicolored, 3 repeating row colors
  - `:test`                  - no colors
  - `:yellow`                - light yellow background
  - `:yellow_border`         - light yellow border

---

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