Documentation

Components

Single Directory Components

Maya ships twenty-eight components in components/. Use them from any template:

{{ include('maya:tile', {
  heading: 'Get a permit',
  url: '/permits',
  description: 'Help keep our buildings safe.',
  variant: 'card',
}, with_context = false) }}

maya:site-header

The dark header. page.html.twig and page--front.html.twig fill it from the header regions.

Slot Notes
branding Seal and lockup (the Header region).
language Language switcher (the Header language region).
search Search form (the Header search region). Below 1024px a search button opens it.
navigation Main navigation (the Primary menu region). Below 1024px a menu button opens it.
{{ include('maya:site-header', {
  branding: page.header,
  language: page.header_language,
  search: page.header_search,
  navigation: page.primary_menu,
}, with_context = false) }}

maya:page-header

The top of a page, after SF.gov's PageHeader and ImageHeader. page-title.html.twig renders every page title with it, and full node views that are not the page's main content render it in node.html.twig with an h2.

Prop or slot Type Notes
title slot Required.
label string Orange label above the title.
label_hidden boolean Keeps the label for screen readers only.
heading_level 1, 2 Default 1.
description slot Large text below the title.
back_url, back_text string Arrow link. The text defaults to "Back to main page".
agency_url, agency_text string Primary agency link.
part_of array of {url, text} Links after "Part of", separated by commas.
image slot A logo or an image, as set by image_style.
image_style logo, image, profile logo (default): the right 3 of 12 columns from 1024px, between the label and the title below that, at most 120px wide. image: the right 5 of 12 columns from 768px, below the links below that, with rounded corners. profile: a 220px circle left of the text from 768px (28px away, 60px from 1024px), centered above it below (Components-8 p3).
pronouns string Below the title, in parentheses, in the description size.
caption slot Below the image when image_style is image.
rule boolean Ends the header with a 4px blue rule.
hero slot Full-width image behind the top of the header, which then sits on a white card. The header breaks out of maya-container.
content slot More content after the links.

Pass description, image, caption and hero as variables (include), since the layout depends on which of them are set; title and content are also Twig blocks.

{{ include('maya:page-header', {
  title: 'Recology',
  label: 'Agency',
  description: 'Collection of trash, recycling and compost.',
  agency_url: '/departments/environment',
  agency_text: 'San Francisco Environment Department',
  part_of: [{ url: '/zero-waste', text: 'Zero waste' }],
  image: content.field_logo,
}, with_context = false) }}

Fields on node pages

On a node's page, its full view, preview and revisions, maya_preprocess_page_title() fills the header from the node's fields through Drupal\maya\PageHeader, the same way paragraph components guess their fields. Each part takes the first field shown by the node's full display (else its default display) whose type and machine name fit:

Part Field type Machine name contains
Hero Image, or media of image types hero, banner, cover, header
Logo Image or image media logo, seal, emblem
Image Image or image media image, photo, picture, portrait
Caption Text caption, credit; else such a field on the image's media
Description Plain or formatted text description, summary, intro, lead, subtitle, tagline
Pronouns Plain text or list pronoun
Back link Link, or reference to content or terms back, main_page, return
Primary agency Reference to content or terms agency, department, organization, office, division
Part of Reference to content or terms part_of, parent, campaign, program, collection, series

A logo wins over an image; an image gets its caption and the blue rule, except on people's pages (see People, events and places), where it is the round profile photo. Fields hidden in the display are never used, and fields the header uses are left out of the node's content. The label is the content type, except for basic pages (page). With a hero image, the Breadcrumb region moves below the page title block, so the image starts right below the site header.

To choose fields yourself, open Appearance > Settings > Maya > Page header: each content type lists its parts with the automatic choice, a field to use instead, or "None". The choices are stored in the page_header theme setting, by content type and part (hero, logo, image, caption, description, back, agency, part_of), with _none for an empty part.

maya:site-alert

A solid site-wide banner. block--region--alerts.html.twig renders every block in the Alerts region with it.

Prop or slot Type Notes
title string
variant info, danger Default info (blue). danger is red.
dismissible boolean Shows a dismiss button once js/maya.js runs.
dismiss_key string Names the alert in sessionStorage. Change it when the alert changes so it shows again. Defaults to the title.
content slot Text of the alert.
{% embed 'maya:site-alert' with { title: 'Heat advisory', variant: 'danger', dismissible: true, dismiss_key: 'heat-2026-07' } %}
  {% block content %}<p>Cooling centers are open. <a href="/cooling">Find one</a></p>{% endblock %}
{% endembed %}

maya:alert

An in-page alert: a tinted box with a colored bar on the left, an icon, a title and text, after SF.gov's Alert (Components-2 p6). status-messages.html.twig renders Drupal's status messages with it.

Prop or slot Type Notes
title string Bold, 16px (20px from 768px).
title_hidden boolean Keeps the title for screen readers only.
heading_level 2–6 Default 2.
variant info, success, warning, danger, archived Default info. Blue, green, orange, red, and orange with an archive box.
dismissible boolean Shows a dismiss button once js/maya.js runs. It hides the alert on this page only.
content slot Text of the alert. Links are bold.
{% embed 'maya:alert' with { title: 'This location is closed', variant: 'danger' } %}
  {% block content %}<p>The office reopens on Monday. <a href="/hours">See hours</a></p>{% endblock %}
{% endembed %}

Status messages map Drupal's types to variants: status to success, warning to warning, error to danger. Messages added in JavaScript with Drupal.Message get the same markup from js/messages.js, with the icon drawn in CSS.

maya:callout

A bordered, tinted note with an icon, after SF.gov's callouts (Components-2 p5, and p7 with a heading).

Prop or slot Type Notes
title string
heading_level 2–6 Renders the title as a black heading of that level, with the icon beside it at every width. Without it the title is bold text in the variant's color, and below 768px the icon sits above it.
variant info, success, warning, danger, archived Default info.
content slot Text of the callout.
{% embed 'maya:callout' with { title: 'Birth certificates', variant: 'warning' } %}
  {% block content %}<p>The County Clerk does not keep birth certificates for children under 3 years old.</p>{% endblock %}
{% endembed %}

Callouts in CKEditor 5

The same classes on a paragraph give the callout box, with the icon drawn in CSS, in the editor and on the page. Enable the Style plugin on the text format and add styles such as:

p.maya-callout|Callout
p.maya-callout.maya-callout--success|Callout: success
p.maya-callout.maya-callout--warning|Callout: warning
p.maya-callout.maya-callout--danger|Callout: danger
p.maya-callout.maya-callout--archived|Callout: archived

The format's allowed HTML must include <p class="maya-callout maya-callout--success maya-callout--warning maya-callout--danger maya-callout--archived">. A callout styled this way has no separate title; start it with bold text.

maya:button

A link or button styled as a button (Components-4 p3). Every variant has hover, keyboard focus (the 3px blue outline, 4px off the button, over the hover look) and disabled states.

Prop Type Notes
label string Required. Kept for screen readers on icon-only buttons.
url string Renders a link; without it, a <button>.
variant primary, light, outline, text, arrow, inverse Default primary. arrow is the bold underlined link with an arrow before it. inverse is for dark backgrounds.
large boolean 52px high with 16px text; default 40px with 14px.
icon string Icon name from templates/includes/icon.html.twig, before the label.
icon_only boolean Square button with only the icon (arrow-right when icon is empty).
type button, submit, reset For <button> only. Default button.
disabled boolean A link gets aria-disabled="true" and loses its href.
{{ include('maya:button', { label: 'Apply online', url: '/apply', large: true }, with_context = false) }}
{{ include('maya:button', { label: 'Next', icon_only: true, variant: 'outline' }, with_context = false) }}

Drupal's own buttons get the same styles: the first button in a form's actions and .button--primary are primary, other .button elements are outline, .button--danger is red, .button--small is 32px high.

maya:tag

An orange status pill, such as "Cancelled" on an event (Components-3 p1). 24px high, 28px from 768px.

Prop Type Notes
label string Required.

maya:chip

A filter pill (Components-4 p11–14). Put several in a ul.maya-chips list.

Prop Type Notes
label string Required.
url string Renders a link, such as the current page without this filter; without it, a <button>.
removable boolean Shows × after the label; screen readers hear "Remove filter: {label}".
selected boolean Filled, with a check mark. A <button> chip that is not removable is a toggle with aria-pressed.
icon string Icon name, before the label.
{{ include('maya:chip', { label: 'Permits', url: '?type=', removable: true }, with_context = false) }}

maya:details

An accordion item on <details> (Components-5 p1), so it opens and closes without JavaScript. The paragraph type mapped to Accordion item renders with it.

Prop or slot Type Notes
title string Required.
heading_level 2–6 Wraps the title in a heading inside the summary.
variant accordion, more accordion: blue bold 20px title, plus that turns to a minus, gray rule, open text on a gray panel. more: a slab section heading (24px, 32px from 768px, 40px from 1024px) with "Show more" and a chevron on the right that read "Show less" when open.
open boolean
name string Items with the same name close each other when one opens.
content slot
{% embed 'maya:details' with { title: 'Who can apply', name: 'faq' } %}
  {% block content %}<p>Anyone who lives or works in San Francisco.</p>{% endblock %}
{% endembed %}

Plain <details> in body text, and Form API details elements, get the accordion look without the component.

maya:show-more

Cuts long text to a height, or a list to its first items, with a centered "Show more" button over a gray rule that turns to "Show less" (Components-5 p1, p3). The text fades out at the cut. Without JavaScript all the content shows.

Prop or slot Type Notes
height integer Pixels to cut to. Default 240. Content no more than 60px taller is left whole.
items integer Shows this many items of the first list in the content instead of cutting to a height. A list with only one more item is left whole.
more_text, less_text string Button text. Default "Show more" and "Show less".
content slot
{% embed 'maya:show-more' with { items: 5 } %}
  {% block content %}{{ content.field_services }}{% endblock %}
{% endembed %}

maya:card

A linked card (Components-14). The heading's link covers the whole card.

Prop or slot Type Notes
heading string Without one the card shows its image and description, and links nowhere.
url string
heading_level 2–6 Default 3.
variant regular, featured, highlight, plain, news Default regular. See below.
image_ratio 1:1, 16:9, 3:2 Crops the image. Defaults: regular 16:9, featured 3:2, news 1:1; highlight and plain keep the image's own ratio.
label string Featured: orange label above the heading ("Featured"). News: the type ("Press release").
date string Formatted date, for featured and news cards.
agency_url, agency_text string News: agency link below the heading.
image slot Image or media. It fills the image box.
description slot Text below the heading. Regular cards show it only when they have no heading.
Variant Look
regular Bordered box with a bold blue heading (p2, p12–15, p21–27). With a 1:1 image the image fills the card's right end, 102px wide, and the heading is 16px; with a 16:9 image the image sits on top and the heading is 20px from 768px. Regular cards show a 3:2 ratio as 16:9, the only ratio Figma gives an image on top. Without an image it is a text-only card. The card shows the heading alone, as Figma draws it, and its description only when it has no heading. Headings stop after two lines, three without an image; the card fills its grid row, and text below an image starts at the top.
featured Orange label, blue slab heading and text below a 3:2 image (p1). Without an image the heading is larger (46px from 1024px); with neither an image nor a description it is smaller, with the date below it (p28).
highlight Blue 24px heading and text below an image (p17).
plain Black 20px heading and text cut after three lines, below an image (p16).
news News list item (p10, p18): type, 24px heading, agency link and date, with a 158px square thumbnail at the end and a rule below. With a description, the date and type come first. The columns follow the width of the element holding the card, not the viewport: the thumbnail shows from 480px, the date and type column from 800px.
{{ include('maya:card', {
  variant: 'news',
  heading: 'Mayor Lurie signs legislation to boost office conversions',
  url: '/news/office-conversion',
  label: 'Press release',
  agency_url: '/departments/mayor',
  agency_text: 'Office of the Mayor',
  date: 'June 6, 2025',
  image: content.field_image,
}, with_context = false) }}

Figma's card with an image caption and gray text (p29) uses sizes outside the design tokens and is not built.

maya:card-group

A heading over a grid of cards, the "page group" of Components-14 p30–32 and p43–45: three columns from 1024px, two from 768px, one below, with "See more results" after the first items (maya:show-more).

Prop or slot Type Notes
heading string Slab, 24px, 32px from 768px, 40px from 1024px.
heading_level 2–6 Default 2.
columns 1–4 Columns from 1024px. Default 3.
more integer Items shown before "See more results". Without it, or without JavaScript, all show.
description slot Intro text between the heading and the grid.
items array Render arrays, one per cell, printed as a list.
content slot Instead of items: a ul.maya-card-group__items of your own.
{{ include('maya:card-group', {
  heading: 'Recycling and composting',
  more: 12,
  items: cards,
}, with_context = false) }}

Views whose rows are cards (any variant but news) get the same grid, whatever wraps each row; rows of news cards and tiles stay stacked.

A card group of maya:profile cards, or a view of profile teasers, is the profile list of Components-14 p19, p37 and p49: one column below 768px with 28px gaps, two from 768px and three from 1024px, 40px apart.

maya:tile

Prop Type Notes
heading string Required.
url string Required.
description string Cut after three lines.
icon string link and card tiles: an icon from icon.html.twig before the heading, such as data, document, news or calendar (Components-14 p4).
date string link and card tiles: shown as "Published DATE" below the description.
variant link, card, quick link: underlined bold blue heading and an arrow, with a rule below (p4, p46–48). card: the same in a bordered box. quick: arrow in a circle before a slab heading.

Link tiles in a .maya-tile-list are 20px apart above and below their rule, 24px from 1024px.

Node teasers

node--teaser.html.twig renders node teasers, and view modes whose machine name starts with "teaser" or contains card, tile, list, featured, highlight or news, as a maya:card, or a maya:tile for the tile variant. Drupal\maya\Teaser picks the variant from the view mode's name:

View mode name contains Variant
featured, feature, hero featured
highlight highlight
news, horizontal, list, row, search news
tile, link tile
anything else regular

"1x1" or "square", "3x2", and "16x9" or "wide" in the name set the image ratio. The card then takes its parts from the fields the view mode's display shows, without field names written in the theme:

Part First shown field that fits
Image An image field or a media reference
Description A long text field
Date A date, date range, Smart Date or timestamp field, shown as "June 6, 2025"; else the authored date when the content type displays author and date
Agency A reference to content or terms with agency, department, organization, office or division in its name

When the display shows a paragraph field (a "teaser" paragraph), the parts the node's own fields leave empty come from the first referenced paragraph's fields, as its default display shows them. News cards show the content type as their label; featured cards show "Featured" for content that is sticky at the top of lists. Fields the card does not use follow the description.

To choose the variant and ratio yourself, open Appearance > Settings > Maya > Teasers. A view mode whose name does not make it a card, such as "square", becomes one when you give it a variant there. The choices are stored in the teasers theme setting:

teasers:
  teaser_horizontal:
    variant: news
    image_ratio: '1:1'

maya:profile

A person (Components-14 p6, p11, p19, p37, p49 and p53, after SF.gov's ProfileGroup).

Prop or slot Type Notes
name string Required. 20px bold blue, underlined.
url string Card: the whole card links here, with a focus ring around it (p11). Leader: the button links here.
heading_level 2–6 Default 3.
variant card, leader card (default): 80px photo beside the text. leader: the agency leader block, with a round photo (144px, 180px from 768px) beside the text from 768px and a large "See full profile" button.
role string Bold line above the name.
pronouns string Below the name, in parentheses.
titles array of strings Job titles, one per line.
button_text string Leader only. Default "See full profile".
seal_url string Stands in for a missing photo. Defaults to the active theme's logo.svg; teasers pass the site logo.
image slot The photo, cropped square or round.
description slot Leader only: text above the button.
{{ include('maya:profile', {
  name: 'Connie Chan',
  url: '/profile/connie-chan',
  pronouns: 'she/her',
  titles: ['Supervisor', 'District 1'],
  image: content.field_photo,
}, with_context = false) }}

For a list of profiles under a heading and intro, put the cards in a maya:card-group.

maya:event

An event or meeting (Components-9 p1 and Components-14 p5, after SF.gov's EventItem).

Event cards with date blocks in a sideswipe list

Prop or slot Type Notes
heading string Required.
url string Links the heading.
heading_level 2–6 Default 3.
variant list, card list (default): agency link below the heading, rows side by side from 1024px, a rule below. card: date block (102×112, from 1024px) or date bar (below) and the kind of event above a 16px heading (20px from 768px).
start string ISO 8601 start. The card's date block shows its month and day; the date row gets a <time> element.
label string Card: the kind of event, such as "Meeting".
cancelled boolean Adds the orange "Cancelled" tag after the heading (below it below 768px).
agency_url, agency_text string List: the agency below the heading.
date, time, location string Rows with calendar, clock and pin icons, as formatted text.
description slot Text below the rows, at most 640px wide.

maya:agenda-item

A numbered item: a meeting agenda item (Components-9 p2, p4–6, after SF.gov's AgendaItemBlock) or, with timeline, a step on a timeline (Components-9 p7).

Prop or slot Type Notes
heading string Required. 20px, 24px from 768px, 32px from 1024px.
number string or integer In a teal circle (32px, 40px from 1024px).
heading_level 2–6 Default 3.
id string ID of the heading, for links to the item.
timeline boolean Step look: 40px circle (60px from 1024px), slab heading, a teal line from the circle down the item, text beside the line.
tag string Orange pill after the heading, above it below 768px, such as "Optional".
details array of {icon, label, text} Rows below the heading, such as { icon: 'cash', label: 'Cost', text: 'Free' }.
content slot Rich text, documents and links. Agenda items span the full width below the heading.

Not built: p7's "Show more" that folds a step below 768px.

maya:timeline

Milestones on a 4px teal line, side by side from 768px and stacked below (Components-9 p3, after SF.gov's Timeline).

Prop Type Notes
items array of {title, text} Required.
heading string Slab heading above the line.
heading_level 2–6 Default 2.

maya:contact

Contact information in columns, each under an icon and a title: Address, Phone, Email, Social media and Additional info, in that order, one column per kind present (Components-11 p14, p25, p30–31, p38, p95–97, after SF.gov's ContactFooter). From 768px the columns sit side by side at equal widths with 1px rules between them; below, they stack with rules between them. In columns narrower than 260px the hours stack the times under the day (a container query, as in SF.gov's Location).

Prop or slot Type Notes
heading string Slab heading with an orange rule below.
heading_level 2–6 Default 2; column titles are one level lower.
addresses array {names, lines, directions_url, hours, note}: bold names (department, addressee, location name), street lines 20px apart, "Get directions", hours as {day, times} rows, a note.
phones array {owner, number, extension, note}. The number and extension link to tel:.
emails array {title, email}.
social array {network, url, text}. network is facebook, instagram, threads, x, bluesky, linkedin, mastodon, tiktok or youtube, which sets the brand icon and its color (the neutralFacebook… tokens); text defaults to the network's name.
additional array {title, text}.
address_extra slot Rich text below the addresses, such as opening hours kept in a text field.
additional_extra slot Rich text in the Additional info column.
image slot Below the columns.

Contact fields on node pages

In a node's full view, Drupal\maya\Contact gathers the fields the display shows into one maya:contact headed "Contact", placed where the first of them was:

Column Fields
Address Address fields (organization and name as bold lines, the street, then city, state and ZIP code, and a Google Maps link), then text fields named hours, opening_hours or office_hours
Phone Telephone fields
Email Email fields
Social media Link fields, for the links that point to Facebook, Instagram, Threads, X or Twitter, Bluesky, LinkedIn, TikTok or YouTube

The component shows when the display shows an address, telephone or email field. Other link fields stay in the content. Structured opening hours, phone owners and extensions, and Additional info have no field mapping: pass them to the component from a template.

maya:location-card

A place: a 3:2 image or map, the name, address lines, "Get directions" and an outline button to its contact information (Components-14 p38, Components-8 p2).

Prop or slot Type Notes
heading string Required.
heading_level 2–6 Default 3.
variant raised, side, plain raised (default): white, bordered, with a shadow. side: gray, image right of the text from 768px. plain: gray.
lines array of strings Address lines.
directions_url string "Get directions" link.
url, button_text string The button. Text defaults to "View full contact information".
image slot Cropped to 3:2.

maya:status-card

The status of a service, centered: icon, heading, status, text and link (Components-14 p39).

Prop or slot Type Notes
heading string Required, such as "City Offices".
status string Bold line below, such as "Normal operation".
icon string Default city-hall, 64px.
link_url, link_text string Link below the text, such as "All departments".
content slot The text.

People, events and places

Drupal\maya\NodeKind marks content types whose machine name contains a word for people (bio, biography, person, people, profile, staff, official, member, leader, employee), events (event, meeting, hearing, workshop) or places (location, place, office, facility, venue). To choose yourself, open Appearance > Settings > Maya > People, events and places; the choices are stored in the node_kinds theme setting, with _none for none:

node_kinds:
  vendor: location

Teasers of these types (see Node teasers) render as follows. Each part takes the first field that fits among those the view mode shows, then among the node's other fields, so a person's job titles and an event's date show even where the display leaves them to a teaser paragraph. The image and description come only from shown fields, as for cards.

Kind Component Parts
People maya:profile card Image; job titles from text or list fields named title, job, job_title or position; pronouns from a field named pronoun; role from a field named role. Without an image, the site logo.
Events maya:event: a list item for view modes that make news cards (news, horizontal, list, row, search), a card for the others Start and end from the first date, date range, Smart Date or timestamp field, as "Saturday, December 1 to Sunday, December 31, 2026" and "9:00 a.m. to 3:00 p.m."; location from an address field, else a text or list field named location, venue, place or format; "Cancelled" from a boolean field named cancel or a text field named status whose value contains "cancel"; agency and description as for cards; the content type as the card's label.
Places maya:location-card: side for news view modes, plain for plain ones, else raised Image; address lines and directions from an address field; the button links to the node.

On a person's page, the header shows the image as the round profile photo and the pronouns field below the title.

Not mapped: the agency leader block (maya:profile with variant: leader), agenda items, timelines and the status card have no content types or paragraph types on sites built so far. Agenda items expect a paragraph with a title, rich text and documents (SF.gov's agenda_item block), numbered by their position; a timeline expects title and text pairs.

In-page navigation

These components help readers find their way around a long page or a section of the site (Components-11 p1, p9, p16–18, p22, p41–43; Components-13 p3–10). They are meant for the In-page navigation region (see Regions), which is in the sidebar from 1024px and above the content below that.

maya:on-this-page

"On this page" and links to the page's h2 headings, built by JavaScript when the page loads. Headings without an id get one from their text, and headings are scrolled to with 32px above them. Each link shows up to two lines. A list longer than limit plus one shows limit links, the last faded, and a "Show all" button; "Show all" moves focus to the first link it reveals. Without JavaScript, or with fewer headings than minimum, nothing renders.

Prop Type Notes
title string Default "On this page".
source string CSS selector of the element whose headings are listed. Default main. Headings inside nav, aside, header and footer elements, inside the In-page navigation region, and hidden ones are left out.
levels integer 1 lists h2 headings; 2 also lists the h3 headings under each, indented (Components-11 p1, right). Default 1.
limit integer Default 10.
minimum integer Default 3, as SF.gov.

To add it to every page of a content type, use In-page navigation settings.

"Search on this page": a field that highlights what is typed into it wherever it occurs in the page (Components-13 p3–6). Highlighting uses the CSS Custom Highlight API, so the page's markup is not changed. Enter moves to the next match and Shift+Enter to the previous one; the number of matches is announced to screen readers. Matches are light orange and the current one darker. It is hidden without JavaScript and in browsers without the API.

Prop Type Notes
label string Default "Search on this page".
placeholder string Default "Type to highlight text".
source string CSS selector of the element searched. Default main. Text in nav, aside, header and footer elements and the In-page navigation region is left out.

maya:table-of-contents

Numbered links to the steps of a step-by-step page, with "and" and "or" markers for steps that go with the one before, and an optional outline button (Components-11 p16).

Prop Type Notes
title string Default "Table of contents".
heading_level integer 2, 3 or 4. Default 2.
items array { text, url, marker }. marker is and or or; steps without one are numbered in order.
button_text, button_url string Such as "Contact us".
{{ include('maya:table-of-contents', {
  items: [
    { text: 'Get a marriage license', url: '#step-1' },
    { text: 'Get married in person at City Hall', url: '#step-2' },
    { text: 'Get married somewhere else in San Francisco', url: '#step-2-and', marker: 'and' },
    { text: 'Record your marriage', url: '#step-3' },
  ],
  button_text: 'Contact us',
  button_url: '/contact',
}, with_context = false) }}

Maya does not map step pages to it, since sites store steps differently. In a sub-theme's node template, build items from the steps field; maya:agenda-item with an id gives each step an anchor.

Section navigation

A menu block placed in In-page navigation renders with menu--section.html.twig (Components-11 p9, p16; Components-13 p3–10). From 1024px it is a list: first-level links bold at 20px, their children at 16px, and the current page in a dark blue pill. Below 1024px it is a dropdown labeled with the block's title, the "Current section title" of the frames. The dropdown is a <details> element, so it works without JavaScript; js/maya.js closes it on outside click and on Escape. The current page is the deepest link in the active trail, marked aria-current="page".

Use Menu Block to show one branch of a menu: set Initial visibility level to the section's level, Expand all menu links, and, for a dropdown label that follows the section, Block title to the parent or active trail item. Core menu blocks work too.

A button in a content block placed after it, such as <a class="btn" href="/contact">Contact us</a>, sits beside the dropdown from 768px, as a 52px primary button below 1024px and a 40px outline button from 1024px (Components-13 p3, p7).

In-page navigation settings

Appearance > Settings > Maya > In-page navigation lists the content types that get "Search on this page" and "On this page" on their pages. Both print at the top of the In-page navigation region, search first, and list or search the page's #main-content. The choices are stored in the in_page_nav theme setting:

in_page_nav:
  page_search: [data_story]
  on_this_page: [page, data_story]

maya:spotlight

Prop or slot Type Notes
heading string At most 65 characters; longer headings are cut with an ellipsis (p9).
button_text, button_url string The button shows when both are set. Black spotlights use the light button.
image_position right, left, top Default right. top: the image runs the full width above the text at its own ratio (p34). Below 768px the image is always on top.
overlay boolean The image fills the spotlight, cropped to the height of a white card that sits 28px in on the side away from image_position (p34, p58). Below 768px the image runs edge to edge at 4:3 and the card overlaps its bottom. color does not apply.
color blue, green, orange, black Default blue. Headings are dark blue, dark teal or dark red to match; text is black, or white on black.
image slot Image or media. Cropped to 4:3 beside the text.
caption slot Credit below the image, 14px, such as "“Wonderful image” by Artist Name".
body slot Text below the heading, at most 125 characters (46 on a small overlay card).

Spotlights run edge to edge below 1024px and are a rounded panel from there, as the home page spotlight and paragraphs mapped to Spotlight do. With only an image (no heading, body or button), the spotlight renders as a banner without its colored panel.

{% embed 'maya:spotlight' with { heading: 'Fleet Week', button_text: 'Find out more', button_url: '/fleet-week', image_position: 'left' } %}
  {% block image %}{{ content.field_image }}{% endblock %}
  {% block body %}{{ content.body }}{% endblock %}
{% endembed %}

maya:band

Prop or slot Type Notes
heading string
background auto, white, neutral, primary, secondary auto alternates inside .maya-zebra.
content slot

Forms

Form API elements are styled by element and core class (Components-7), from css/src/base/forms.css and three templates in templates/form/. No form alters are needed for the look; the one alter adds "(Optional)" markers.

Part Look
Label 20px. A required field's label ends with a red * in <span aria-hidden="true">, so screen readers hear the control's own required state instead of "star".
"(Optional)" Gray, after the label of each field that is not required, in forms that have at least one required field. Not added to single checkboxes and radios.
Description 16px gray, between the label and the control, for every field whose description is not invisible. On a single checkbox or radio it sits under the label.
Error message 14px red with an alert icon, between the description and the control. The control gets a light red fill and red border and text, until it has focus. Needs core's Inline Form Errors module; without it Drupal lists errors in the status messages only.
Text fields, selects, text areas 56px high (text areas 100px), black 1px border, 4px corners. Focus is a 3px blue border. Disabled fields are gray. Selects have a 24px chevron.
Prefix and suffix #field_prefix and #field_suffix sit in a gray box joined to the field, as "feet" in Components-7 p33.
Radios and checkboxes 40px boxes, 16px from their label, 16px apart. Checked: blue fill with a white check, or a blue dot. Focus: a 3px blue ring 3px off the box.
Fieldsets No border. Radios and checkboxes get a legend in the label style. Other groups, such as an address, get a 20px legend over 16px labels 28px apart; .address-container-inline (Address module) and .webform-flexbox (Webform) put parts such as state and ZIP code side by side.
Multiple select A plain <select multiple> is a list box with selected options in blue (p26). With Choices.js, as Webform uses for elements with "Choices" enabled, selected options are blue chips in the field (p1, p37–40).
Character count Webform's counter and Maxlength's .counter are 14px gray, right-aligned under the field.
Spacing Fields are 36px apart, 60px from 1024px, and at most 624px wide (7 of 12 columns at 1280px). Buttons in .form-actions are 16px apart.

Admin forms, including node edit forms when "Use the administration theme when editing or creating content" is on, use the admin theme.

Multi-page forms

maya:step-indicator shows progress through the sections of a multi-page form (Components-11 p2–3, p10; Components-7 p23–28). From 1024px it is a vertical list: done steps have a green check and an underlined title, the current step a black dot and an 18px bold title, upcoming steps a gray dot; a solid green line joins the done steps and a dotted gray line the rest. Below 1024px it is a "Section 4 of 8: Title" dropdown with the same list. The steps print twice and CSS shows one, as the section navigation does. The dropdown is a <details> element; js/maya.js closes it on outside click and on Escape.

Prop Type Notes
steps array { title, state, url, attributes, title_attributes }. state is done, current or upcoming (default). url links a done step. attributes and title_attributes are HTML attributes of the step and of a done step's title.
label string Name of the <nav> landmark. Default "Form progress".
{{ include('maya:step-indicator', {
  steps: [
    { title: 'About you', state: 'done', url: '?page=1' },
    { title: 'Type of vending', state: 'current' },
    { title: 'Vending hours' },
  ],
}, with_context = false) }}
  • Webform: with Show wizard progress bar on, the wizard's progress prints as the step indicator (templates/webform/), whether or not the progress-tracker library is excluded. From 1024px it floats beside the 624px column of fields, in the last four of twelve columns (p27). With Link to previous pages in progress bar on, Webform's JavaScript turns done steps into links. Show wizard progress pages and percentage print below it as small gray text. The wizard's buttons follow p23 and p27: a light "Back" with a left arrow, and a primary "Next" with a right arrow at the right of the column of fields.
  • Drupal's installer and update.php: maintenance-task-list.html.twig prints their task list as the step indicator, for sites that use Maya as the maintenance theme.

Filters

Views exposed forms with select lists, checkboxes or radios print their filters as SF.gov's filter dropdowns (Components-5 p4–5, p14), from views-exposed-form.html.twig and src/ExposedFilters.php:

  • From 1024px: "Filter" and a dropdown pill per filter (p5). Each dropdown holds the filter's field and its own Apply and Reset; one opens at a time, and outside clicks and Escape close it. A filter in use keeps the pill's open look.
  • Below 1024px: a "Show filter" / "Hide filter" button over an accordion of the filters, with one Apply and Reset at the end (p4, p14).
  • Under the bar: "Filtering by", a chip for each applied value, and Reset. A chip removes its value, so it is a link to the page without it. Chips for options are the option's label; others are "Label: value", such as "Year: 2026".
  • Multiple-choice select lists become checkboxes. Option groups become bold headings over their checkboxes ("Category 1" in p5). Long lists scroll in the dropdown.
  • Text fields, sorts and the form's own buttons print above the bar as before. Then every dropdown keeps its Apply and Reset at all widths.
  • Reset links go to the page without the filter's query parameters, so the view's own Reset button is not needed.
  • The filter's label names the dropdown, so the field's own label is visually hidden.

Without JavaScript the accordion is open and the dropdowns work as <details>. js/filters.js adds the outside-click and Escape closing, keeps the bar open from 1024px and closes the accordion below it. Filters in an exposed form block of an AJAX view reload the whole page from their chips and Reset links.

Year field

A select list whose options are all years, and a select list or text field labeled or named "year", become a searchable year field with a decade picker (Components-5 p6–12). Add data-maya-year to any other year field, and the maya/filters library.

  • Typing lists the years that start with what was typed, newest first; focusing the field lists every year. Arrow keys move through the list, Enter chooses, Escape closes it (the WAI-ARIA "editable combobox with list autocomplete" pattern).
  • The calendar button opens the decades, newest first, with the decade of the chosen year highlighted, then that decade's years in a grid of four columns. Arrow keys, Home and End move between them; "← 1990s" goes back; Escape closes the picker and returns to the button.
  • A year out of range shows "Please enter a year between 1980 and 2026."; text that matches no year shows "No matching years found. Enter a year between 1980 and 2026." Both are linked to the field with aria-describedby.
  • The range comes from a select list's options, or from a text field's min and max, then data-maya-year-min and data-maya-year-max, then 1900 to this year.
  • A select list stays in the form, hidden, and takes the chosen year, so the view gets the value it expects. Without JavaScript the plain field shows.

Pagers

pager.html.twig and views-mini-pager.html.twig follow Components-12.

  • Full pager: Previous and Next outline buttons around the page numbers. The first and last pages always show, the current page sits in the middle in a light blue circle, and an ellipsis stands for two or more pages: 1 … 4 5 6 … 20 from 768px, 1 … 5 … 20 below it, where Previous and Next shrink to arrow buttons. On the first and last page the missing button keeps its space, so the numbers do not move. "First" and "Last" links are left out because the first and last pages are always listed.
  • Mini pager (Views): Previous on the left, Next on the right. Turn on the view's More link to show it between them with an archive icon, as SF.gov's "See archives before November 2022"; set its text and a custom URL in the view. Below 768px the link sits above arrow buttons.

Tables

Tables from table.html.twig and Views tables print inside a .maya-table wrapper; tables in body text get the same look (Components-13).

Part Look
Cells 16px text, 20px padding, a gray rule under every row. Columns are at least 130px wide, 180px from 768px and 150px from 1024px.
Header row Bold on a gray band.
Row headers <th> cells in the body are bold on gray with a rule on their right. Both kinds can be combined.
No header row A rule above the first row.
Caption The table's title, in the slab section heading style above the table.
Wide tables Scroll sideways inside their wrapper, with a shadow on the side that has more to show. Tables in body text are scrolled by CKEditor 5's <figure class="table">; older body text tables get a .maya-table wrapper from js/maya.js.

The Figma frames show narrow screens scrolling the table sideways, not stacking its cells, and Maya does the same.

Rich text

Formatted text fields get .maya-text styles from css/src/components/text.css, also loaded into CKEditor 5 (Components-15).

Element Look
h2 Roboto Slab, 20px, 24px from 1024px; 40px above, 20px below.
h3 Bold, 16px, 20px from 768px; 40px above, 20px below.
h4 Extra bold, 16px; 36px above, 8px below.
p 16px on 24px lines, 20px apart.
ul, ol Indented 24px, items 12px apart.
hr 2px dotted gray rule, 28px above and below, 40px from 768px, 60px from 1024px.
img 4px corners.
blockquote 16px text on a gray panel with 20px padding and 4px corners.
Links Blue and underlined, except links with the btn class, which keep the button look.

Media

maya:video

A video with transcript links (Components-6 p1, p6). "Show transcript" / "Hide transcript" shows the transcript below the video, or beside it, as tall as the video and scrolling, when the component is 880px or wider. "View full transcript" links to a full transcript, and "Watch recording" to a recording kept elsewhere. Iframes and <video> elements in the video slot are sized 16:9. Without JavaScript the transcript shows and the toggle is hidden.

Prop or slot Type Notes
video slot An iframe or <video>.
transcript slot The text "Show transcript" shows.
transcript_url string Adds "View full transcript".
recording_url string Adds "Watch recording".
recording_text string Default "Watch recording"; add the length, as "Watch Recording (1 hour)" in p6.

Video media (remote video and video file sources) render as maya:video from media.html.twig. Fields shown in the media's display whose machine name contains transcript fill it: a text field gives the transcript, a link or file field "View full transcript". A link field whose machine name contains recording gives "Watch recording" and its link text. p1's "Follow video" checkbox, which highlights the transcript as the video plays, needs timed captions and is not built.

maya:social-accounts

"Official accounts" and a list of social media accounts (Components-6 p2, p5): the network's icon, the account name in bold, the handle in blue and a chevron, each row a link over a gray rule.

Prop Type Notes
accounts array { network, name, handle, url }. network is facebook, instagram, threads, x, bluesky, linkedin, mastodon, tiktok or youtube.
title string Default "Official accounts".
title_hidden boolean Hides the title visually.
heading_level integer 2–6. Default 2.
columns integer 2 for two columns from 768px. Default 1.

Social posts

X/Twitter posts embedded with core's oEmbed media keep to the 550px Twitter draws them at; the post itself is drawn by Twitter in its iframe. Wrap a list of posts in .maya-social-feed for the bordered, scrolling column of p5.

Loading spinner

Drupal's AJAX progress indicators are the gray turning ring of Components-10: .ajax-progress-throbber inline, 20px, before its message; .ajax-progress-fullscreen 32px on a white circle in the middle of the window. With reduced motion the ring turns at a third of the speed.

CSS classes

For custom blocks, Layout Builder and CKEditor styles:

Class Use
maya-container 1076px page container with Maya's side margins.
maya-grid 6-column grid, 12 columns from 768px.
maya-zebra, maya-band Full-width sections that alternate white and gray.
btn Primary button; the maya:button component prints it. Add btn--light, btn--outline (btn--secondary is the 1.x name), btn--text, btn--arrow or btn--inverse for the other variants, btn--large for 52px, btn--icon for an icon-only square, btn--block for full width.
maya-link, maya-link--heading Text links without an underline until hover (Components-4 p2); --heading is the bold slab size. Links in body text stay underlined.
maya-tag Orange status pill.
maya-chip, maya-chip--selected, maya-chips Filter pills and their list.
maya-step-marker Numeral in a teal circle (Components-3 p2), 32px, 40px from 1024px. Add maya-step-marker--large (40px, 60px from 1024px), or --and / --or for the outlined markers between alternative steps.
maya-spotlight Spotlight layout.
maya-card-tile, maya-card-grid Bordered link tile boxes and their grid.
maya-link-tile, maya-tile-list Link tiles and their list.
maya-quick-link, maya-quick-links Quick links and their grid.
maya-card, maya-card-group__items Cards and their grid; the maya:card and maya:card-group components print them.
maya-teaser Wrapper of a node teaser's card or tile.
maya-callout Callout box with an icon. Add maya-callout--success, --warning, --danger or --archived for the other colors. See Callouts in CKEditor 5.
maya-details, maya-details--more Accordion on a <details> element; see maya:details.
maya-table Wrapper that lets a wide table scroll sideways.
maya-social-feed Bordered column of social posts that scrolls.
maya-text Rich text styles. Applied automatically to formatted text fields.
maya-lead Large introductory paragraph.

Utilities

Tailwind utility classes use SF.gov's names: text-primary500, bg-neutral50, font-slab text-heading-xl lg:text-desktop-heading-xl. Tailwind only includes utilities it finds in the theme's templates, so a sub-theme that uses new utilities must build its own CSS. See Development.

Edit this page