Defaults
A diagram opens on its first view, on its overview, with every scenario waiting to be chosen. The defaults: block changes that for one diagram, in the file that describes it, so every page that shows the diagram opens it the same way.
This diagram opens on the sign-in scenario, drawn as a sequence diagram, with the panel folded to its button:
defaults: scenario: sign-in mode: sequence sidebar: falseFields
Section titled “Fields”| Field | Meaning |
|---|---|
view |
The view shown first. Without it, the view of scenario, then the first view. |
scenario |
The scenario selected first. Without it the diagram opens on its overview. It waits for the reader to press play, unless autoplay is on. |
mode |
How a scenario is drawn when it has no mode of its own: flow (packets over the diagram), sequence or story. |
sidebar |
Whether the panel over the picture, with the outline and the views, starts open. Without it, the panel starts open when there is another view to choose. |
subtitles |
Whether the step’s title and description show on the bar while the scenario plays. On by default. |
autoplay |
Play scenario as soon as the diagram is on screen. It needs a scenario, and readers who ask their system for reduced motion are never autoplayed. |
Every field is optional. The compiler checks that view and scenario exist, and that a scenario named with a view plays on that view.
Who decides
Section titled “Who decides”The page that shows a diagram can always choose otherwise. From the strongest to the weakest:
- The reader. A link to a scenario and step (
#checkout=place-order.3) opens there, and the controls change anything. - The page. The props of
<Diagram>:view,scenario,mode,autoplay,sidebarandsubtitles. A page that names a view that the default scenario does not play on opens that view with nothing selected. - The scenario. Its own
mode:wins overdefaults.mode. - The diagram’s defaults.
- What idocs does without being told.
This is the same diagram, shown with view="auth-path" mode="story" sidebar. The page asked for another view, so the default scenario, which plays on the overview, is left out, and the panel is open.
Things to know
Section titled “Things to know”- The mode sticks. Choosing a scenario that names no
modekeeps the mode the reader is in, so someone who switched to the sequence view stays there. Going back to the overview returns todefaults.mode. - A narrow widget still folds the panel.
sidebar: truein the file means “open when there is room”. A widget under about 640 px starts folded unless the page passessidebaritself. - Links stay quiet. The address bar records where the reader is only when it differs from how the diagram opens, so a default scenario does not rewrite the URL of every page that shows it. Choosing the overview of a diagram that opens on a scenario is recorded as
#name=~. - Nested diagrams use their own. A diagram that is shown in place or opened from a node takes the view and scenario that node names, and otherwise opens as its own
defaultssay.autoplayonly applies to a diagram on a page, not one opened from another.