Skip to content

wire:text

Laravel Livewire Documentation Reference

Since Magewire is heavily inspired by Laravel Livewire, many concepts are either identical or very similar. To avoid duplicating documentation, this page only covers Magewire-specific and platform-specific details. For all general concepts and in-depth explanations, you can refer to the corresponding Laravel Livewire documentation.

Livewire Reference

wire:text writes a component property into an element's text content:

<output wire:text="formattedTotal"></output>

Magewire maps this directive to Alpine's x-text. Because it writes text rather than HTML, markup in the value is not interpreted by the browser. Prefix the expression with ! for a boolean inverse, or use a normal escaped PHP expression when the value only needs to change after a server render.

Use a translated, server-formatted public property for customer-facing currency, dates, and labels. Do not move Magento formatting rules into the directive expression.