# `Alternera.Resource.UI.Surface`
[🔗](https://github.com/10e-ab/alternera-sdk/blob/v0.9.0/alternera_resource_ui/lib/alternera/resource/ui/surface.ex#L1)

The optional callbacks of a surface (`use Alternera.Resource.UI,
:surface`), for one offered as a Workbench item: the Workbench calls them
as it calls its own item types.

  * `load/2` runs when the tab opens and when a reload restores it, with
    the `arg` the tab was opened on; what it returns is the component's
    `state` assign until the tab closes. Without it `state` is nil.
  * `title/1` names the tab from that state; without it the tab takes
    the declaration's label.
  * `request_close/1`: the tab asks before it closes; `{:ask, question}`
    keeps it open with the question shown (unsaved work).

# `load`
*optional* 

```elixir
@callback load(arg :: String.t() | nil, Alternera.Resource.UI.Context.t()) ::
  {:ok, term()} | {:error, String.t()}
```

# `request_close`
*optional* 

```elixir
@callback request_close(state :: term()) :: :close | {:ask, String.t()}
```

# `title`
*optional* 

```elixir
@callback title(state :: term()) :: String.t()
```

---

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