# tmux_model:new/2

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_model.erl#L192
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_model-new-2/

```
new(Entity, Fields)
-spec new(atom(), map()) ->
             {ok, row()} |
             {error, tmux_schema:error_detail()}.
```

Construct a detached row from validated observations.

Accepts dynamic maps, including malformed input that returns a tagged
`t:tmux_schema:error_detail/0`. For trusted typed code, prefer the entity
constructors such as `pane/1` and `t:pane_input/0`.

## Examples

```erlang
1> {ok, Pane} = tmux_model:new(pane, #{id => <<"%1">>, width => 120}), ok.
ok
2> tmux_model:get(width, Pane).
120
```

## Parameters

- `Entity` (`atom()`)
- `Fields` (`map()`)

## Guides

Pages that discuss `new/2`.

- [Native API documentation](/en/erlang/latest/guides/api-documentation/)
