# `Cardbox.View`
[🔗](https://github.com/hattoriai/cardbox/blob/v0.1.0/lib/cardbox/view.ex#L1)

A saved view of a collection: how it shows (`type`), which records, in
which order (`query`, `Cardbox.Query`'s wire format), and the options of
its type.

| Type | Shown with | Options |
| --- | --- | --- |
| `table` | Masu | `columns` (field keys, in order), `hidden`, `widths` (`%{key => px}`) |
| `board` | Narabe | `group_by` (a select, status, person or checkbox field), `hidden_groups`, `card_fields` |
| `list` | Narabe | `fields` |
| `calendar` | Koyomi | `date_field` (a date field) |
| `chart` | Fude | `kind`, `x` (and its `unit`), `y`, `color`, `title` (see `Cardbox.Fude`) |
| `canvas` | Hakushi | `layout` (`%{record_id => %{"x" => x, "y" => y}}`), `edges` (a relation field) |

A view with no `owner` is shared with everyone who has the collection;
a view with an owner (a person's id) is theirs.

An app adds types of its own (`use Cardbox, views: ["timeline"]`), whose
options its `c:Cardbox.check_view/3` checks, and draws them itself: a
view of any type has its query, and `list/3` of it gives its records.

# `t`

```elixir
@type t() :: %Cardbox.View{
  __meta__: term(),
  collection: term(),
  collection_id: integer() | nil,
  id: integer() | nil,
  inserted_at: term(),
  name: String.t(),
  options: map(),
  owner: String.t() | nil,
  position: String.t() | nil,
  query: map(),
  type: String.t(),
  updated_at: term()
}
```

# `types`

```elixir
@spec types() :: [String.t()]
```

Cardbox's types of views.

---

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