Header
fun-header is a sticky, slot-driven page header.
- Attaches a scroll listener to the nearest scrollable parent, falling back to
window. The source is re-evaluated after each layout change via aResizeObserver, so the correct scroll root is picked up after route changes or async content loads without remounting the header. - Switches between
defaultandscrolledmodes using a configurable breakpoint with hysteresis to avoid rapid toggling. - Content is composed entirely through named slots — the component has a minimal prop surface.
Built-in Behavior
-
Scroll-driven mode: switches to
scrolledmode once scroll offset exceedsbreakpoint + breakpointHysteresis; returns todefaultbelowbreakpoint - breakpointHysteresis. -
Title: accepts either a
pageTitlestring prop or aslot="title"element (e.g.fun-field-label). Both are single-line with end-truncated ellipsis. The title shrinks fromh1toh2in scrolled mode. -
Subtitle: collapses with a CSS grid animation when scrolled. Always single-line with ellipsis.
-
Auto slot assignment: direct unslotted
fun-buttonchildren are automatically assignedslot="primary"(variantprimary) orslot="secondary"(all other variants). -
Action button sizing:
fun-buttonelements inslot="primary",slot="secondary", and insidefun-button-group[slot="primary"]are kept atsize="md"via aMutationObserver. -
Actions layout (left to right):
slot="super"→slot="tertiary"→slot="secondary"→slot="primary". Each action slot only renders if content is present. -
slot="super": optional superuser dropdown — quiet button- IMP: Always wrap this in a condition that checks for super user access. -
slot="tertiary": optional overflow dropdown — secondary button trigger with an ellipsis icon. Items receive full-width layout inside the dropdown. -
slot="secondary": inline secondary actions. Button text is hidden on mobile via CSS. -
slot="primary": inline primary action, rightmost. Supports a singlefun-buttonor afun-button-group. Button text is hidden on mobile via CSS. -
Extra row (
slot="extra"+slot="extra-right"): collapses with a CSS grid animation when scrolled, unlessshowExtraOnScrollistrue. -
Breadcrumbs: rendered above the header when
breadcrumbsLinkshas at least one link and a title is present. Hidden when total crumb count (links + current) is one or fewer. -
Scroll root: by default
fun-headerwalks its ancestors to find the first scrollable element, then falls back towindow. Passscroll-root(web component) /scrollRoot(React) to pin an explicit scroll container — useful when the scroll container is outside the header’s ancestor chain, e.g. a shell layout or micro-frontend wrapper.
Examples
Index pages
Here is an example of typical index page. Full page demo here
- Does not have breadcrumb
- Has description
- Actions:
- One primary action : either Button group or regular button
- Max. 1 secondary action with icon
- No tertiary actions
- Optional super user actions
Details pages
Here is an example of typical details page. Full page demo here
- Required breadcrumb starting fron index page (moving away from home as root)
- Text or FunFieldLabel (fun-field-label) as title
- Optional badge for
- Status (fill with color, no icons)
- Type (Outline neutral with icon/brandlogo)
- Actions:
- Max one primary button based on the context.
- Max. 2 secondary action with icon. Edit is always secondary.
- Tertiary actions in dropdown triggered by ellipsis (awalwys in the order of below with divider between each section)
- Data exploration : Open in data explorer, Open in data chat
- Entity speicific actions : Edit name, Reconnect etc.
- Duplicate, Copy to workspace(s)
- Disable & delete (always in text-fun-danger)
- Optional super actions
Edit pages
Here is an example of typical Edit page. Full page demo here
- Breadcrumb: Starts from index page (not home)> entity > Edit
- Title: always the name of the enitity either as text or FunFieldLabel (fun-field-label)
- Actions
- Primary: Save (with icon: check)
- Secondary: Cancel (with icon: times)
Create page: Default
Here is an example of typical Edit page. Full page demo here
- Breadcrumb:
- Rule: Always ends with create
- Entity > Listing [optiona] > Create (ex: Expors > Destinations > Create, Metrics > Create)
- Header:
- Title should always be similar to the CTA that triggers it (ex: Connect data source, Crate export etc)
- When the create is a step after slecting from list - it should be in a badge - outlined, neutral with brand logo.
- Actions:
- Save & Cancel
Create page: with wizerd
Here is an example of typical Edit page. Full page demo here
- Breadcrumb:
- Rule: Always ends with create
- Entity > Listing [optiona] > Create (ex: Expors > Destinations > Create, Metrics > Create)
- Header:
- Title should always be similar to the CTA that triggers it (ex: Connect data source, Crate export etc)
- When the create is a step after slecting from list - it should be in a badge - outlined, neutral with brand logo.
- Actions:
- Save & Cancel
Specifications
Properties
| Property | Attribute | Required | Description |
|---|---|---|---|
| breadcrumbsCurrent | breadcrumbs-current | The current (non-linkable) crumb label for the fallback `fun-breadcrumbs`. | |
| breadcrumbsLinks | breadcrumbs-links | Breadcrumb links used by the fallback `fun-breadcrumbs`. | |
| breakpoint | breakpoint | Base scroll breakpoint, in px. | |
| breakpointHysteresis | breakpoint-hysteresis | Additional px used to avoid rapid mode toggling near the breakpoint. | |
| pageTitle | page-title | The page title shown in the header. | |
| scrollRoot | scroll-root | Pin the scroll source explicitly. Accepts an `HTMLElement` or a CSS selector string (e.g. `"#main-scroll-area"`). Use when the scrolling container is outside `fun-header`'s ancestor chain — for example a shell layout wrapping a micro-frontend, or any SPA router outlet. Web component attribute: `scroll-root` React prop: `scrollRoot` When omitted, `fun-header` walks its ancestors and falls back to `window`. | |
| showExtraOnScroll | show-extra-on-scroll | Keep the extra slot row visible while in scrolled mode. Subtitle still collapses. | |
| subtitle | subtitle | Optional subtitle shown next to the title. |
Slots
| Name | Description |
|---|---|
| badge | Badge element displayed next to the title. |
| extra | Extra content row displayed below the title and actions. |
| extra-right | Right-aligned content in the extra row, styled as muted small text. |
| primary | Primary action button (or `fun-button-group`) shown inline in the header. |
| secondary | Secondary action buttons shown inline in the header. |
| super | Super-user actions rendered inside a dropdown with a warning-coloured eye icon. |
| tertiary | Overflow actions rendered inside a "more actions" ellipsis dropdown. |
| title | Custom title content rendered instead of the `pageTitle` prop. |