# `LineaUI.Components.Select.Options`
[🔗](https://github.com/devaction-labs/linea_ui/blob/v0.1.1/lib/linea_ui/components/select/options.ex#L1)

The options of a select, in every shape the components accept, read into one shape.

An option is a string or number (label and value alike), a `{label, value}` tuple, a
keyword entry `label: value`, or a map with `:label` and `:value` (and optionally
`:disabled`; any other keys are kept for the `:option` and `:item` slots). A group is
`{group_label, [options]}`.

    iex> LineaUI.Components.Select.Options.normalize(["Wedding", {"Other", "other"}])
    [
      %{type: :option, label: "Wedding", value: "Wedding", disabled: false, data: "Wedding"},
      %{type: :option, label: "Other", value: "other", disabled: false, data: {"Other", "other"}}
    ]

# `group`

```elixir
@type group() :: %{type: :group, label: String.t(), options: [option()]}
```

# `option`

```elixir
@type option() :: %{
  type: :option,
  label: String.t(),
  value: String.t(),
  disabled: boolean(),
  data: term()
}
```

# `find`

```elixir
@spec find([option()], String.t()) :: option()
```

The option whose value is `value`, among `options`; a value that is not one of them becomes its own option.

# `flat`

```elixir
@spec flat([option() | group()]) :: [option()]
```

The options alone, with the groups flattened.

# `normalize`

```elixir
@spec normalize(list()) :: [option() | group()]
```

Reads a list of options and groups.

# `values`

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

The values of a select's `value` as a list of strings.

---

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