Skip to main content

Module placeholder

Module placeholder 

Source
Expand description

What a region shows when it is not showing its content.

The fifth phase-B emitter. makeover_layout::Readiness grew from two states to four at 0.12.0, and this is where the two new ones become markup: goingson drew an empty state at 27 sites across 12 files and Balanced Breakfast at 9, each app with its own class family, and the families had already drifted into empty-state--error against error-state for the same fact.

§Why one function for three states

Pending, Empty and Failed are the same anatomy — a region-sized box with a line of text in it — differing in what the text means and what colour it takes. Three emitters would be three copies of a <div> and a <p>, and the interesting thing about them is precisely the state, which the description carries. Ready renders nothing here by construction: it is the state that shows content, so there is no stand-in to draw.

§The action, and why it arrives as markup

Two of goingson’s 27 empty states offer a way out — “No projects yet” with an “Add your first project” button under it. A button is an address, and no crate in this family names one. So it arrives through Markup, the existing named hole in the escaping, the same way a field’s trailing block does. The caller states that what it is passing is trusted; nothing here can check that for them.

Functions§

placeholder_html
A region’s stand-in, or nothing at all when the region has its content.