Data display
Display
A read-only value laid out like a form field: label, the value in a box with the same size and border as an input, help text and validation error. Use it on show pages and summaries, or in a form to show a value the user cannot change, such as a calculated total.
Nothing to show
The label sits above a box with the text "R$ 100,00", styled like a tk:input but with nothing to type into.
Bound to a Livewire property #
The box shows 'R$ 10,00' and follows the property: when $total changes to 'R$ 30,00', the text changes with it. Inside a Livewire component a name alone does the same when the component has a public property with that name, and the label comes from the name:
This shows the $status property under the label "Status". :wire-model="false" turns that binding off.
Nothing to show
Custom content #
The default slot is the value when there is no value and no bound property, and it takes any markup: here a green "Paid" badge inside the box.
Nothing to show
Rendering from data #
One labeled box per line of the order, such as "Subtotal: R$ 90,00" and "Shipping: R$ 10,00".
Nothing to show
Icon and decorations #
The globe icon sits at the start of the box and the second icon at the end, as on a tk:input. The field control props (prepend, append, kbd, loading) work the same way.
Nothing to show
Description and help #
The field props work as on an input: description under the label, help under the box.
Nothing to show
Prepend #
prepend puts a text at the start of the box.
Nothing to show
Sizes #
size matches the input sizes.
Nothing to show
Alpine binding #
x-model binds to Alpine data; the box follows it in the browser.
Nothing to show
Customization #
Classes go to the box; display:class reaches the <output> element.
Nothing to show
Reference
Display
Accepts the field props (label, description, help, size...) and the field control props (icon, iconTrailing, prepend...). For a display:
valueis the text shown in the box, as is: old input from a failed submit does not replace it.0is shown.placeholderandcolorhave no effect.
The text shown is the first one present: value, then the property bound through wire:model (or through name), then the default slot. wire:model and x-model bind any value that prints as text, and the box follows it as it changes in the browser. Use value or a binding, not both: in the browser the binding overwrites the text that value rendered.
Slots
| Slot | Description |
|---|---|
| default | The value, used when there is no value and no bound property. |
Prefixes
| Prefix | Goes to |
|---|---|
display: |
The <output> element. Only display:class is used. |
Customization
Classes on the tag go to the box. Other attributes go to the <output> element that holds the value. The parts around it take attributes through the prefixes of the field props and the field control props, and one more (listed in the Reference above).
Nothing to show
With a class, the box is a wrapper around the <output>; without one, and without icons or other decorations, the <output> is the box itself. display:class always reaches the <output>.
Accessibility
The value is an <output> element. The label points to it with for, and aria-describedby links it to the description, the help text and the validation error. With a validation error on its name, or with invalid, it gets aria-invalid="true" and a red border.
| Key | Action |
|---|---|
| Tab | Moves focus to the value, which shows the focus ring, so keyboard users can reach and read it. |
Behavior notes
- The
valueand the bound property are escaped: HTML in them is shown as text. The slot is not. - Line breaks in the value are kept and long words wrap inside the box, so a multiline note shows as written. In the slot this includes the indentation of the Blade source.
- An
<output>is not sent with a form even when it has aname. To submit the value, add a hidden input. - Bound with
wire:modelorx-model, the text changes as soon as the property changes in the browser, before any request to the server. - Without a
label, the label is derived from the name or thewire:model(order.numbergives "Number") and translated;:label="false"removes it.