Slot fallbacks

A component can specify fallbacks for any slots that are left empty, by putting content inside the <slot> element:

  1. <div class="box">
  2. <slot>
  3. <em>no content was provided</em>
  4. </slot>
  5. </div>

We can now create instances of <Box> without any children:

  1. <Box>
  2. <h2>Hello!</h2>
  3. <p>This is a box. It can contain anything.</p>
  4. </Box>
  5. <Box/>