Skip to content

Header

In a Récit site (A site), header.formats renders a 44px format menu bar beneath the main header bar. Passing the same items list on every site of a family keeps the row and its width identical from one site to another while marking the current format in place.

TypeScriptrecit.config.ts
import { defineConfig } from "recit/config"; export default defineConfig({ site: { title: "Lorem Ipsum" }, header: { formats: { label: "Formats", items: [ { label: "Lorem", href: "https://example.com/lorem", hue: "sky", status: "available", }, { label: "Ipsum", href: "https://example.com/ipsum", hue: "blue", status: "available", current: true, }, { label: "Dolor", hue: "amber", status: "planned", }, ], all: { label: "Amet", href: "https://example.com/amet", }, }, }, });
KeyType / valuesEffect
header.formatsHeaderFormatsConfigEnables the format menu bar beneath the main header bar.
formats.labelstringAccessible name (aria-label) of the <nav> landmark, and of the scrollable region when the row overflows. Defaults to "Formats" (formatsNavigation in the site's UI strings).
formats.itemsHeaderFormatItem[]Ordered list of formats displayed across the row.
items[].labelstringVisible name of the format (14px, weight 500, var(--recit-text-muted)).
items[].hrefstringTarget URL when status is "available".
items[].hueBrandHueBrand palette hue of the swatch (--recit-hue-<hue>): "violet", "indigo", "blue", "teal", "green", "amber", "orange", "red", "magenta", "sky", "lime", "graphite".
items[].status"available" | "planned""available" renders a link when href is set; "planned" renders plain text without a link.
items[].currentbooleanMarks the current site's format (aria-current="page", full ink var(--recit-text), weight 700).
formats.all{ label, href }Optional trailing link (string label and href) pushed to the far end of the row.

What the menu displays

  • Slanted hue swatch: every item begins with a decorative 8 × 16px swatch (aria-hidden, 3px radius) slanted at skewX(-15deg) (skewX(15deg) in right-to-left layouts) and colored with var(--recit-hue-<hue>).
  • Current format: an item with current: true carries aria-current="page", switches to full ink (var(--recit-text)) and weight 700, and reserves its bold width with an invisible pseudo-element so adjacent items never shift. It stays marked, in full, when it is planned or has no site online yet: the reader is on its site.
  • Format without a site yet: an available item with no href renders as plain text, dims its swatch to 40%, and appends a visually hidden (no site yet) ((pas encore de site) in French).
  • Planned format: an item with status: "planned" renders as plain text with no link, dims its swatch to 40% opacity, and appends a visually hidden (planned) label ((prévu) in French) for screen readers.
  • Row and mobile: the bar sits on var(--recit-surface-2) (44px tall, 16px gap, horizontal padding aligned with the header's, no border or divider), pushes formats.all to the end of the row when set, scrolls horizontally when wider than the viewport (gaining tabIndex={0} and an accessible region name), and is hidden below 48em. On a phone, the available formats with an href and formats.all also open the list of the navigation drawer, before header.navigation.
  • Phone picker: below 48em, a 48px bar under the header (--format-picker-height) shows "Formats" followed by the current format with its swatch, and opens a menu of every format: links for the available ones, planned ones and formats without a site disabled (the current one stays marked with aria-current="page"), formats.all last. The header height counts it. The phone's menu button draws two strokes.

Tabs in the bar

header.placements.tabs places the tabs of the top navigation: on their own row under the bar ("row", the default), or in the bar, before the header links ("bar"), as the « Marques » mockups draw it. Keep "row" for a site with many tabs: the bar has room for four or five.

TypeScriptrecit.config.ts
export default defineConfig({ header: { placements: { tabs: "bar", search: "end" } }, });

With placements.search: "end", the search pill comes after the links, 220 px wide; below 80em it is the magnifier alone, still named « Search ». The header links are 16 px, weight 500.

A centred brand

header.placements.logo places the logo or the site's title: at the start of the bar ("start", the default), or at its centre on a wide screen ("center"), as a shop often draws it. The centre is then the brand's alone: the search, and a navigation placed at the centre, go to the end. A phone keeps the brand at the start. The layout stays a setting of the site: a theme direction never moves the brand.

TypeScriptrecit.config.ts
export default defineConfig({ header: { placements: { logo: "center" } }, });

To tint the background of the header search pill, set --recit-search-bg and --recit-search-bg-hover in the site's styles.css (falling back to --recit-surface-2 and --recit-surface-3):

CSSstyles.css
:root { --recit-search-bg: color-mix( in oklab, var(--recit-hue-sky) 10%, var(--recit-surface-0) ); --recit-search-bg-hover: color-mix( in oklab, var(--recit-hue-sky) 16%, var(--recit-surface-0) ); } [data-mantine-color-scheme="dark"] { --recit-search-bg: color-mix( in oklab, var(--recit-hue-sky) 18%, var(--recit-surface-0) ); --recit-search-bg-hover: color-mix( in oklab, var(--recit-hue-sky) 24%, var(--recit-surface-0) ); }

A button in the bar

header.action adds one call to action, label and to: a button at the end of the bar on a wide screen, after the theme switch, and across the menu on a phone, where following it closes the menu. to is a route of the site or an address; an address of another site opens in a new tab. An empty label or to is refused when the site builds.

TypeScriptrecit.config.ts
export default defineConfig({ header: { action: { label: "Book a visit", to: "/contact" } }, });

The light/dark switch elsewhere

@recit/site/components exports ThemeSwitch, to place the switch in a slot of your own (the Récit sites put it in the footer, footer-after) and set header.themeSwitcher.enabled: false.