Record pages
A record page shows one thing, such as one invoice, on a page of its own. Its main work takes the room and its details sit in a fixed column at the end, as on WordPress’s newer screens. Page shows how to set one up. This page gives every value of how it looks.
What goes where
Section titled “What goes where”- The main work is what grows and what the reader came to do, such as the lines of an invoice, its history or its notes. A long text the reader writes, such as a description, goes here too.
- The details are the record’s own short fields and facts, such as its customer, its dates and its status.
- One header runs across both columns, on one surface. No line, box or shadow marks the details. The space between the columns sets them apart.
The page header
Section titled “The page header”- The title row is at least
--wpds-dimension-size-md(32px) tall, even with no actions, so the title sits in the same place on every page. A compact button is as tall as the row. A button of the default size makes the row taller. - The title shows the edited value, so it follows the field as the reader types. When the field is empty, fall back to a word such as “Untitled”.
- The subtitle is
body-mdin--wpds-color-foreground-content-neutral-weak, with--wpds-dimension-padding-xs(4px) under it. - Breadcrumbs sit before the title, on its line. Each link is
body-lg. A slash in--wpds-color-stroke-surface-neutralfollows it,--wpds-dimension-gap-sm(8px) from the text on each side. - Beside breadcrumbs the title stays on one line and ends in an ellipsis when it does not fit. The links and the actions keep their width.
- The title keeps half of
--wpds-dimension-surface-width-xs(240px), which is 120px. A trail that leaves it less wraps, as the WordPress Forms trail does, and the title moves under it. Actions that leave it less move under the title. - A breadcrumb link breaks a long word, with
overflow-wrap: anywhere, so a record number with no spaces stays inside the row. - Every page opened from a list takes breadcrumbs, a create page too.
- Save comes last in the row. A menu with Delete, named “More options”, comes before it.
The two columns
Section titled “The two columns”- The main work takes all the room the details leave. It has no cap.
Beside the details its content is never narrower than
--wpds-dimension-surface-width-md(400px), and its box adds--wpds-dimension-padding-xs(4px) at each side. - The details are
--wpds-dimension-surface-width-md(400px) wide, at the end of the page, which is the right in English. Their box adds--wpds-dimension-padding-xs(4px) at each side, so it measures 408px. - The columns sit
--wpds-dimension-gap-xl(24px) apart, from the content of one to the content of the other. The--wpds-dimension-padding-xs(4px) at each side is part of that gap. - Each column keeps
--wpds-dimension-padding-xs(4px) of room at each side, inside its box, since a box that scrolls clips what draws past its edge and a focus ring would lose its sides. On a padded canvas its content still meets the edges of the page title. - Inside each column the parts sit
--wpds-dimension-gap-lg(16px) apart. - Both columns break a long word, with
overflow-wrap: anywhere, so it cannot push the page wider. Agodmin-tablekeeps its words whole. - A column clips what runs past its sides, so a wide table goes in a
godmin-table-scroll, which scrolls there at every width. - A
godmin-listin a column stays inside it, so a row and its focus ring stay whole. DataViews keeps its own padding, as a list region in the main work does.
When both do not fit
Section titled “When both do not fit”- The columns sit side by side while the page is at least 824px wide, which is both columns and their gap. No breakpoint decides this, only the page’s own width.
- Below that the details move under the main work,
--wpds-dimension-gap-xl(24px) apart, and both fill the page. The reading order stays the same. - A bleed canvas has no gutter for the room at each side of a column to sit in, so that room stays inside the page. The columns fold at 832px there, and their content sits 4px in from the title.
- The page does not narrow steadily as the window does, since the
sidebar folds at
SIDEBAR_BREAKPOINTand the canvas drops its margin atEDGE_BREAKPOINT. So a window just belowSIDEBAR_BREAKPOINTcan show two columns where a wider one shows one. - An
asidethat renders nothing takes no room, and the main work fills the page. - On a narrow page the details come after everything in the main
work. Show the first rows of a long list with
LoadMore, so a reader can reach them.
What scrolls
Section titled “What scrolls”- The page header stays. While the columns sit side by side each one
scrolls on its own under it, with
overflow: hidden auto, so the details stay beside the row a reader is on. - A column stops at the room under the header. A short column stops at its own end and shows no scrollbar.
- Once the details move under the main work, both scroll together as one box, and neither scrolls alone, so a phone reader meets one scrollbar and not two stacked ones.
- A line
--wpds-border-width-xs(1px) wide in--wpds-color-stroke-surface-neutral-weakruns under the header to the canvas edges. Under page tabs their own line takes its place. - While the columns sit side by side each one keeps
--wpds-dimension-padding-lg(16px) above its content, inside the part that scrolls, so a row scrolls away at the line. Once the details move under the main work, only the main work does. - The columns reach the foot of the canvas, and each keeps
--godmin-canvas-gutter-blockunder its last line. - A page with no
asidescrolls the canvas, as the canvas says. - The columns scroll on their own only when the
Pagesits directly in the canvas. Inside a wrapper of your own, or outside a frame, the record takes its full height and whatever holds it scrolls. - A keyboard scrolls a column from a control inside it, so keep one there, such as a link or a field.
What the details hold
Section titled “What the details hold”- A section is a
SectionTitleand what follows it, with no box around it and no line between sections. - Fields sit one under the other with their label on top, in a
godmin-form, as in WordPress’s media editor. - Facts follow the fields, as rows of a label and a value. A
DataFormwith thepanellayout andreadOnlyfields draws them. Load the@wordpress/dataviewsand@wordpress/componentsstylesheets. The label takes 38% of the row, and the value shows in the weak text color at the default weight. - One fact alone, such as the day a record was made, is a muted sentence.
- A long list or a table goes in the main work.
Forms on a page
Section titled “Forms on a page”- A stacked
godmin-formstops at--wpds-dimension-surface-width-lg(560px), also in a wider main work column, and its fields sit--wpds-dimension-gap-md(12px) apart. - In a
godmin-form__roweach field starts from two thirds of--wpds-dimension-surface-width-xs(240px), which is 160px, and the fields share the rest of the line.
Saving
Section titled “Saving”- On a page with an
aside, one Save button in the page header serves the record’s fields in both columns. It is compact and reads “Save”. A page with noasidekeeps its Save at the end of the form, since its title scrolls away. - It stays off until something changes and while the record saves,
and a keyboard can still reach it. Say both, as in
disabled={!changed || saving}, sinceloadingalone turns it off only whendisabledis not given. While the record saves it shows its loading state and the fields stay in place, turned off. - A change that saved and a write that failed each show a toast, as
what goes in a toast
says. Name what failed, then give the server’s words, as in
Could not save the invoice. The customer is closed. - A server message about one field shows under that field.
- A check made before sending shows under its field. Move the focus to the first field that failed, so it comes into view inside its column.
- A row added to a list, such as a note, keeps its own button and saves at once.
- While the record holds unsaved work, ask before a link in the app leaves the page, such as a breadcrumb, as leaving with unsaved work says.
While a record loads
Section titled “While a record loads”- While nothing of the record is known, the page shows its header and
one
LoadingScreen, with noaside. A screen gives how it looks. Breadcrumbs stay, and the title names the kind of record. - A part that loads on its own shows its
LoadingScreenin its column, at the top and centred across that column. - Show one
LoadingScreenat a time, since each one speaks. - A record that could not load shows an
ErrorNoticeunder the title, with noaside. Breadcrumbs stay, and the title still names the kind of record.
What a screen reader hears
Section titled “What a screen reader hears”asideLabelmakes the details a named region, as landmarks and names lists.PageBreadcrumbsis a navigation region named by itslabel. The slash is hidden.- The main work comes first in the reading order at every width.