# `Alternera.Plugin.Editor.CappedText`
[🔗](https://github.com/10e-ab/alternera-sdk/blob/v0.9.0/alternera_plugin_editor/lib/alternera/plugin/editor/capped_text.ex#L1)

A text shown inline after its label, wrapping anywhere. A long one shows
its first `cap` characters with "Show more"; the whole text unfolds under
it in a scrolling box, with "Show less". The execution view's step
summaries and a plugin host editor's Try trace both show long values
with it.

A native `<details>`, so no server round trip and no icon (nothing here
trips the stream carve-out); `open` is the browser's
(`JS.ignore_attributes/1`), so a re-render does not fold it again.

# `capped_text`

`id` is the text's (the `<details>` when long; `-more`, `-less` and
`-full` follow it inside), `label` goes before the text, `attrs` on the
outer element and `class` on the line.

## Attributes

* `id` (`:string`) (required)
* `label` (`:string`) - Defaults to `""`.
* `text` (`:string`) (required)
* `cap` (`:integer`) (required)
* `attrs` (`:map`) - Defaults to `%{}`.
* `class` (`:any`) - Defaults to `nil`.

# `long?`

```elixir
@spec long?(String.t(), non_neg_integer()) :: boolean()
```

Whether `text` is longer than `cap` characters, so that it folds.

---

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