Maturity: Refining
Usage
Minimal example with only a box body:
<.box>
<p>This is a box.</p>
</.box>
With title, banner, action, and footer:
<.box>
<:title>Profile</:title>
<:banner>
<img src="banner-image.png" alt="" />
</:banner>
<:action>
<button_link patch={~p"/profiles/#{@profile}/edit"}>Edit</button_link>
</:action>
<p>This is a profile.</p>
<:footer>
<p>Last edited: <%= @profile.updated_at %></p>
</:footer>
</.box>
A box is not a named landmark by default. To turn it into one, set id
and point aria-labelledby at its title:
<.box id="profile" aria-labelledby="profile-title">
<:title>Profile</:title>
<p>This is a profile.</p>
</.box>
In this example, the body has the ID profile-body. You pass the ID to a
disclosure button in the :action slot to toggle visibility.