Blackwork
Scroll to top

Layouts

Header, main, footer, and holy-grail columns for content sites.

Layouts

These pieces are the Blackwork page chrome. Compose a sticky header, a content gutter, and a short footer. Add holy-grail columns when a page needs a sidebar or a table of contents.

When to use

  • A blog, docs site, or other content page that should share one gutter
  • A sticky header with brand on the left and site actions on the right
  • An article with a nav column and a table of contents

See Theme for ThemeProvider and ThemeToggle. See Widgets for LanguageToggle and SocialLinks.

Next.js shell

src/app/layout.tsx
TSX
import { LayoutHeader, ThemeProvider, ThemeToggle } from 'blackwork'
import { LayoutFooter, LayoutMain, ThemeScript } from 'blackwork/rsc'

const RootLayout = ({ children }: React.PropsWithChildren) => {
  return (
    <html lang="en" suppressHydrationWarning>
      <head>
        <ThemeScript />
      </head>
      <body className="flex min-h-dvh flex-col">
        <ThemeProvider>
          <LayoutHeader themeToggle={<ThemeToggle />}>Blackwork</LayoutHeader>
          <LayoutMain>{children}</LayoutMain>
          <LayoutFooter>© Blackwork</LayoutFooter>
        </ThemeProvider>
      </body>
    </html>
  )
}

export default RootLayout

Pass brand and nav as children. Social links, a language toggle, and the theme toggle sit on the right.

Header

Blackwork

LayoutHeader

PropTypeDefaultDescription
socialLinksSocialLinkProps[]Icon buttons rendered on the right of the header.
socialLinksVisiblebooleantrueHide social links even when the array has items.
languageToggleReactNodeSlot for LanguageToggle or a custom locale control.
themeToggleReactNodeSlot for ThemeToggle.
childrenrequiredReactNodeBrand and primary navigation on the left.

Main

Main

Page content uses the shared content gutter.

LayoutMain

PropTypeDefaultDescription
fullscreenbooleanfalseDrop the content gutter and vertical padding. Use for full-bleed pages.
asChildbooleanfalseMerge layout classes onto the child instead of a main.

Footer

© Blackwork

Holy grail

There is no wrapper component. Place HolyGrailAside and HolyGrailContent in a flex row. Asides stay hidden below the lg breakpoint.

Holy grail

Article

HolyGrailAside

PropTypeDefaultDescription
smallerbooleanfalseNarrower column. Typical for a left nav. The default width fits a table of contents.
asChildbooleanfalseMerge column classes onto the child.

RootLayout

RootLayout is a full document shell: html, head with ThemeScript, and body with ThemeProvider.

RootLayout

PropTypeDefaultDescription
langstring"en"html lang. Use a BCP 47 tag such as en or zh-CN.
metadataReactNodeExtra nodes rendered inside head, after ThemeScript.
classNamestringClasses for body.

Notes

  • LayoutHeader is sticky. Override with className if you need it in a nested preview or a non-sticky bar.
  • LayoutMain fullscreen drops the shared gutter. Use it for a landing page that paints edge to edge.
  • HolyGrailAside smaller is the narrow nav column. The default width fits a table of contents.