Table of Contents

The yield keyword is a shorthand syntax for outputting a variable and also define the fallback content if it does not exists.


Let’s say we want to display a variable containing some HTML markup and if it does not exists, we want to have some fallback markup.

Without yield
  {{{ $slot.content }}}
  <h2> Some fallback markup </h2>
With yield
  <h2> Some fallback markup </h2>