Components, general

Every story of every component at the top of `mantra_starter/components` -- the pieces that are not tied to one part of the page: the branding, the buttons, the cards and the grid they sit in, headings, links, the pager, the search box, tables, tags and the rest. The component library at `/ui-components` is still the place to read one component, with its props and its schema; this is the page that puts them next to each other, in the theme, at the width the theme serves. Nothing here is authored: each block is a `*.story.yml` committed beside its component, so the page and the library cannot disagree. Every story is made up and nothing is saved.

Branding

Site name, logo, slogan.

mantra_starter:branding

Name and slogan only

A site with no logo uploaded. Each of the three parts is printed only when it has a value, so this is the case where the name has to carry the navbar on its own.

Drupal, built to be looked after

Default

This is the site slogan

Logo only

The name and the slogan turned off in the site branding block, which is what a site whose logo carries the name does.

Button

Buttons allow the user to take actions or make choices.

mantra_starter:button

Default

Label

Default

Buttons demo

List all buttons

mantra_starter:buttons_demo

Default

Button link

Card

mantra_starter:card

Web Development

Card carrying only content, with no image, title or caption.

Web Development

Kona xBike

Card as used in the Bikes grid view (retrograde site, /bikes).

Kona gravel bike
Kona xBike
xBike | $800

Card Grid

mantra_starter:card_grid

Topics

Content-only cards, to show the grid without images.

Web Development
Web Design
Databases
Git

Bikes

The first three rows of the Bikes grid view (retrograde site, /bikes).

Field

mantra_starter:field

Default

A label and a body, which is the shape every field render array arrives in.

Gallery

mantra_starter:gallery

Default

Three thumbnails. The row height comes from `field_thumbnail_height` on the paragraph the gallery is built from; there is no paragraph here, so the template falls back to its 12rem default.

Heading

mantra_starter:heading

Default

The tag is a prop rather than a fixed element, so the same component can sit at whatever level the surrounding document has reached.

A heading rendered as h2

With classes

`heading_classes` is added to the element's attributes, so a caller can size a heading without the component knowing anything about the scale.

A heading rendered as h3, sized by its classes

Span

The default tag. A heading that looks like one but must not enter the document outline -- the label of a list, say -- is a span.

A heading rendered as span

Hero

mantra_starter:hero

Default

A background image with the content set over it. `title` and `url` are declared on the component but the template does not print them -- the heading and the link belong to whatever is placed in the content slot.

Built for the long way round

Frames, wheels and the parts that hold them together, chosen for roads that run out. See the bikes Klein Attitude, 1995

Text only

No background image. The background element is still emitted, so this is the case to check that an empty one collapses rather than leaving a band of whitespace above the content.

Workshop hours

Tuesday to Saturday, nine until six. Repairs booked in by Thursday go out the same week.

Link

Link examples.

mantra_starter:link

Hover

hover: hello

Visited

visited: hello

Active

active: hello

Default

link: hello

Pager

Views pager.

mantra_starter:pager

First page

Four pages, sitting on the first. Previous and first are dropped, and so is the leading ellipsis -- the template hides first while the numbers already start at 1, so this is the case where the row must not open with a gap.

Default

Page 3 of 8, which is the only state that puts every item on the page at once: first and previous on the left, last and next on the right, an ellipsis either side of the numbers, and the current page marked. `current` and `ellipses` are set by template_preprocess_pager() rather than declared on the component, and they are what decides which of those items appear.

Teaser

Internal label and resource link.

mantra_starter:reference

Default

An internal label linked to the node it names, and the resource it points at printed as its own URL.

Unpublished

The same reference with `published` false. The template does not act on the prop today; this is the story to check against once it does.

Screenshot

mantra_starter:screenshot

Default

An image in the frame the theme puts around a screenshot. A real screenshot is used rather than a photograph, because the frame is what the component contributes and a photograph hides where it ends.

A screenshot of the Olivero theme

Search Box

mantra_starter:search_box

Default

The form the site search block renders as. `key` is the query parameter the input is submitted under, so it has to match what the target route reads.

Swiper

mantra_starter:swiper

Default

Three slides, the pagination, the two arrows and the scrollbar. The markup is what Swiper is initialised against; without its JavaScript running the slides simply stack, which is the state to check the unenhanced page in.

Kona gravel bike
Klein Attitude bicycle
Panasonic NJS track bike

Swiper slide

mantra_starter:swiper_slide

Default

One slide on its own. The slide is a 16:9 box and the image is contained inside it, so a picture of any shape keeps every slide the same height.

Kona gravel bike

Table

A table that carries the theme's column width roles. A role is declared once, on the column, and the component puts it on the header cell and on every body cell in that column -- which is the part that is tedious by hand and easy to get wrong, because auto layout sizes a column from the widest content in it, so a role on the header alone leaves a long body cell free to widen the column anyway. The table is wrapped in the scroll container, so it keeps its natural width and scrolls sideways rather than having its columns crushed.

mantra_starter:table

Empty

No rows. The header is still printed, and `empty` fills a single cell spanning every column -- so a filter that matches nothing keeps the columns it was filtering rather than collapsing the table to one narrow cell.

Components matching the filter
Component Status Operations
No components match the filter.

Sticky header

The same table with `sticky` on. The table is given a bounded height and a scrollbar of its own -- a sticky header sticks to its scroll container, and a container with no height never scrolls, so the header would otherwise leave with the page. Scroll the table, not the page, to see it hold.

Default

Every role at once: a shrink-wrapped check box column, a growing title, a prose column sized at 24 characters, a column that is empty in every row, and shrink-wrapped operations.

Components, with a role on every column
Component Summary Operations
Card An image, a heading and a short run of text, linked as a whole. Edit
Hero The first thing on a page: a heading, a paragraph and at most one call to action. Edit
Primary navigation The menu of the site, which collapses into a toggle below the breakpoint. Edit

Tag

mantra_starter:tag

Default

Drupal