Header
Header Examples
Copy-ready examples with live previews.
Basic usage
Header container with left slot (sideButton) and brand slot.
Live preview
Basic header
import Header from "@/packages/ui/src/_components/header/Header";
import { Button } from "@/packages/ui/src/_components/buttons_variants/buttons/Button";
import { Title } from "@/packages/ui/src/_components/text/title/Title";
export default function Example() {
return (
<Header
variant="primary"
height="64px"
width="100%"
zIndex={50}
sideButton={<Button variant="transparent">Menu</Button>}
brand={<Title size="h4">cssnt</Title>}
/>
);
}Slots (sideButton / brand)
You can provide both slots, only one, or none.
Live preview
Slots
import Header from "@/_components/header/Header";
export default function Example() {
return (
<>
<Header variant="white" sideButton={<button>Menu</button>} brand={<span>Brand</span>} />
<Header variant="white" brand={<span>Brand only</span>} />
<Header variant="white" sideButton={<button>Back</button>} />
<Header variant="white" />
</>
);
}Variants gallery
Variant maps to `cssnt-header--*` classes (colors/tonal surfaces).
Live preview
All variants
import Header from "@/_components/header/Header";
export default function Example() {
return (
<>
<Header variant="primary" />
<Header variant="primary-tonal" />
<Header variant="success" />
<Header variant="success-tonal" />
{/* ... */}
</>
);
}Sizing (height / width) + zIndex
Use inline styles to control layout sizing and layering.
Live preview
--_h via inline style. width and zIndex are also inline styles.height + width + zIndex
import Header from "@/packages/ui/src/_components/header/Header";
export default function Example() {
return (
<Header
variant="secondary-tonal"
height="48px"
width="100%"
zIndex={10}
/>
);
}Custom styles
Add extra inline styling for padding/borders/shadows.
Live preview
customStyles
import Header from "@/packages/ui/src/_components/header/Header";
export default function Example() {
return (
<Header
variant="white"
height="64px"
customStyles={{
paddingInline: 16,
borderBottom: "1px solid rgba(0,0,0,0.10)",
}}
/>
);
}Interactive playground
Quick way to test combinations (variant + height) in the docs.
Live preview
Playground
import { useState } from "react";
import Header from "@/packages/ui/src/_components/header/Header";
type HeaderVariant = "white" | "primary" | "secondary-tonal" | "danger" | "info-tonal";
export default function Example() {
const [variant, setVariant] = useState<HeaderVariant>("white");
return (
<Header
variant={variant}
height="56px"
width="100%"
sideButton={<button>Menu</button>}
brand={<span>Header</span>}
/>
);
}On this page
Header Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| variant | "white" | "black" | "primary" | "secondary" | "tertiary" | "success" | "warning" | "danger" | "info" | "primary-tonal" | "secondary-tonal" | "tertiary-tonal" | "success-tonal" | "warning-tonal" | "danger-tonal" | "info-tonal" | No | undefined | Visual style class appended from `variantClasses` (`cssnt-header--*`). If omitted, only the base `cssnt-header` class is applied. |
| sideButton | React.ReactNode | No | undefined | Left slot (commonly a button/icon button). Rendered inside `cssnt-header__side`. |
| brand | React.ReactNode | No | undefined | Brand slot (logo/text). Rendered inside `cssnt-header__brand`. |
| height | string | No | "64px" (SCSS default) | Sets CSS variable `--_h` via inline style (used by your SCSS to size the header). |
| width | string | No | undefined | Inline `width` style (e.g. `"100%"`, `"var(--layout-w)"`). |
| zIndex | number | No | undefined | Inline `z-index` style. |
| customStyles | React.CSSProperties | No | undefined | Inline styles merged into the header. Note: `width`, `zIndex`, and `--_h` are applied after `customStyles` and will override any colliding keys. |
| className | string | No | undefined | Extra class names appended to the root. |
Components