DocCard presents a document as a card with a cover, for the places where the document's author chose a visual listing. It is a named component defined in read.contract L151-L178. The whole card is one link that pushes the document.
Used by
Parent | Where |
|---|---|
A query block whose style is Card: once as the banner, and once per item in the grid. See embed and query blocks |
Through it, cards appear only inside the body of a document.
Props
Prop | Type | Effect |
|---|---|---|
| a document item | Destination, cover image, title, summary, date, authors, comment count |
| true or false | The larger first-card variant |
| string | For tests only |
Like DocItemRow it receives the app's minute clock for relative dates.
Anatomy
A link laid out as a column, radius 12, clipped, filled with -exact-secondary-background.
Cover, only when the document has an image: full width, 120 points tall (200 for a banner), cropped to fill. It runs edge to edge; the card's rounded corners clip it.
Body, 12 points of padding, 4 points between lines:
Title, at most two lines.
Summary in -exact-subheadline, -exact-secondary-label.
A flexible spacer, so footers line up along the bottom when two cards share a line.
Footer, 6 points below the text, 8 point gaps: FacePile, the date in -exact-caption1 grey taking the remaining width on one line, then CommentCount at the right.
Variants and states
Regular | Banner | |
|---|---|---|
Cover height | 120 points | 200 points |
Title style |
|
|
Summary lines | 2 | 3 |
Width | A grid cell | The full width of the reading column |
Case | Result |
|---|---|
No image | No cover; the card is text on the grey surface |
No summary | Title, then the footer |
No authors, date or comments | No footer |
No date | A spacer keeps the comment count at the right |
Cards have no loading state of their own. A query block shows nothing until its items arrive.
Layout in a grid
The card sets no width. Its parent places it: on a phone one card fills the line; in a wider reading column cards share a line on a 200 point basis, unless the document's author set a single column. flex=1 and the internal spacer make cards on one line equal in height. The grid rules are on DocBlockView: embed and query blocks.
Rules for use
Use it only where the content asks for cards. In the app that is a query block with the Card style. Lists the app builds itself ("In this space", an author's Documents) are rows.
Use the banner for the first item only, and only when the block says so.
Do not add actions to a card. It is a single link.
Do not nest it in another filled panel: it uses the same -exact-secondary-background and would disappear into it.
Why it looks this way
It honours the author's layout. In Seed a query block has a style, chosen by whoever wrote the document. The source says the card is the "RN QueryBlockView's Card style / DocumentCard" carried over from the React Native app. A reader sees the page the way it was arranged. See Reading first and What changed from the React Native app and why.
The surface is a platform role. One fill, -exact-secondary-background, gives a soft grey card in light mode and a raised dark grey one in dark mode with no second colour. There is no shadow and no border. See Color and tokens and Light and dark.
Faces, not names. A card is narrow, so authorship is a FacePile and the date sits beside it. See Names, not identifiers.
Radius 12. The cards and panels of the Read tab all use 12, slightly rounder than the 10 used for images and code. See Spacing, radii and sizes.
Differences from DESIGN.md: it describes a query block as a "list of document rows (title, summary, date)" and gives 10 as the radius for cards. The built app adds this card presentation with radius 12; DESIGN.md has no DocCard.
User stories
This page helps deliver these stories. Each story lists this page in its Trace, so the link holds in both directions (traceability).
US-READ-03 Follow links between documents: A query result card that opens its document
US-READ-08 See the documents under and inside a document: A query result as a card, with the banner variant
Related
Parent page: Read components. Siblings: DocItemRow, the row form of the same information.
Patterns: Cards and panels. Type: Typography.
How it is built: Read: screens and components, Read: loading pages, caches and embeds.
Source: read.contract L151-L178.
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime