Skip to main content

Compositions

Build page frames, navigation, headings, sections, and footers with @n3wth/ui/site.
3 min read

Site components own the shared layout and typography. Your application supplies content, route links, and active state. Complete the quickstart first; the examples here assume an ancestor N3wthProvider and an imported site.css.

Build a page frame#

n3wth-site-main adds the top spacing used with site navigation. SiteSection adds vertical spacing; it does not add the container's horizontal constraints. Put sections inside a container, or put a container inside a full-width section when the section needs its own background.

Structure and typography reference#

ComponentProps and defaultsUse
SiteContaineras: div (default), main, section, article; HTML attributesConstrain and align content
SiteSectionNative section propsSeparate page regions vertically
PageHeaderRequired title; optional description, actions, aside; level: 1 (default) or 2; align: start (default) or centerIntroduce a page or major region
SiteHeadingvariant: page, section (default), item; optional level: 1–6Choose visual role and semantic heading level
SiteTextvariant: body (default), supporting, lede; as: p (default), span, divBody text with shared typography
SiteSectionLinksNative nav propsIn-flow links to sections or documents
SiteDocSectionOptional title; level: 2 (default) or 3; HTML attributesGroup long-form content
SiteDocListRequired items: React nodes; list attributes except childrenRender a document list

Heading variants default to levels 1, 2, and 3 respectively. Set level explicitly when visual size and document hierarchy differ. SiteDocSection renders a div, not a semantic section.

SiteNavigation requires brand and links, both React nodes. Optional props are actions, navigationLabel (default Primary), navigationId, and menuLabel (default Open menu). It accepts HTML attributes but does not take a children slot.

Pass anchors or your router's link components. The current UI docs app passes React Router NavLink elements. The composition does not resolve routes or calculate which link is active.

The mobile disclosure focuses the first link when opened. It closes on link selection, outside pointer interaction, Escape, or a transition to the desktop media query. Escape restores focus to the menu button. Keep navigation links as actual anchors so the click and focus behavior can find them.

Document content#

SiteFooter defaults to an Oliver Newth brand link and Library, Contact, and GitHub links. For another product, pass your own brand and links as in the frame example.

PropBehavior
brandReact node; null omits the brand
linksReplaces the complete default link group
sourceHrefChanges the default GitHub link; defaults to the monorepo URL
legalLinksAppended only when using the default link group
childrenAdditional footer metadata below the link row

Supplying links means legalLinks and sourceHref no longer construct that group. Include those links yourself when replacing it.

Sources#