# `Spectre.Definition.Component`
[🔗](https://github.com/elchemista/spectre/blob/0.3.0/lib/spectre/definition/component.ex#L1)

One typed component in a canonical Definition envelope.

`criticality` tells older runtimes whether unknown semantics must fail
closed. Security- and execution-relevant components use
`:must_understand`; descriptive metadata never grants authority.

# `criticality`

```elixir
@type criticality() :: :must_understand | :advisory | :descriptive
```

# `t`

```elixir
@type t() :: %Spectre.Definition.Component{
  component_type: atom() | String.t(),
  criticality: criticality(),
  payload: term(),
  schema_ref: String.t()
}
```

# `from_data`

```elixir
@spec from_data(map()) :: {:ok, t()} | {:error, term()}
```

Restores a component from its portable envelope representation.

# `new`

```elixir
@spec new(map() | keyword()) :: {:ok, t()} | {:error, term()}
```

Builds and validates a canonical Definition component.

# `new!`

```elixir
@spec new!(map() | keyword()) :: t()
```

Builds a component or raises with its stable validation reason.

# `to_data`

```elixir
@spec to_data(t()) :: map()
```

Returns the portable envelope representation of a component.

---

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