# `LineaUI.Component.Helpers`
[🔗](https://github.com/devaction-labs/linea_ui/blob/v0.1.1/lib/linea_ui/component/helpers.ex#L1)

What every component shares: ids, form fields and the color vocabulary.

The colors are LineOne's: `neutral`, `primary`, `secondary`, `accent`, `info`, `success`,
`warning`, `error`. In dark mode LineOne paints `primary` with `accent`, so every `primary`
style carries its `dark:` accent counterpart.

# `assign_field`

```elixir
@spec assign_field(map()) :: map()
```

Fills `id`, `name`, `value` and `errors` from `field` when one is given.

`errors` is the list of translated messages, shown only once the field has been used
(`Phoenix.Component.used_input?/1`).

# `bool`

```elixir
@spec bool(boolean()) :: String.t()
```

`"true"` or `"false"`, for `data-*` and `aria-*` attributes.

# `colors`

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

The color names every colored component accepts.

# `gen_id`

```elixir
@spec gen_id(String.t()) :: String.t()
```

A unique DOM id, for a component that needs one and was not given it.

# `translate_error`

```elixir
@spec translate_error({String.t(), keyword()} | String.t()) :: String.t()
```

Turns an Ecto-style error tuple into text. Set your own translator with

    config :linea_ui, :translate_error, &MyAppWeb.CoreComponents.translate_error/1

---

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