Page top bar
Compose compact page context and actions above the primary page heading.
With breadcrumbs
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let pageTopBarExample (breadcrumbs: HtmlElement) =
fvePageTopBar {
div {
_class "flex min-w-0 flex-1 items-center"
breadcrumbs
}
}
let renderPageTopBar breadcrumbs = pageTopBarExample breadcrumbsOn this page
Installation
Copy this component and its required dependencies into the consumer-owned Components project.
dotnet fve add page-top-bar --config src/Acme.Components/fve.jsonNo additional JavaScript import is required.
The CLI resolves dependencies and preserves consumer-authored files. See Installation for project initialization, Tailwind, the shared runtime, and building/loading your app entry.
Usage
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let pageTopBarExample (breadcrumbs: HtmlElement) =
fvePageTopBar {
div {
_class "flex min-w-0 flex-1 items-center"
breadcrumbs
}
}
let renderPageTopBar breadcrumbs = pageTopBarExample breadcrumbsFull-width shell bar
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let shellTopBarExample =
div {
_class "@container/fve-shell"
fvePageTopBar {
fvePageTopBarBrand {
strong {
_class "text-base font-semibold"
"Workspace"
}
}
fveBreadcrumbs {
_id "shell-bar-breadcrumbs"
_ariaLabel "Shell breadcrumb"
fveBreadcrumbItem {
_href "/components"
"Home"
}
fveBreadcrumbItem {
_href "/components/table"
"Items"
}
}
fvePageTopBarActions {
a {
_href "/examples/application/profile"
_class "whitespace-nowrap text-sm font-medium"
"View profile"
}
}
}
div {
_class "flex min-h-32"
div {
_class "hidden w-60 shrink-0 @3xl/fve-shell:block"
fveSideNav {
_id "shell-top-bar-navigation"
_ariaLabel "Workspace"
fveSideNavContent {
fveSideNavItem {
_href "/components"
"Home"
}
fveSideNavItem {
_href "/components/table"
"Items"
}
}
Html._width SideNavWidth.Standard
}
}
div {
_class "min-w-0 flex-1 px-4 py-6 sm:px-6 lg:px-8"
p {
_class "text-sm text-[var(--fve-muted-text)]"
"Page region"
}
}
}
}This example also uses Breadcrumbs, SideNav. See their Installation sections for any additional setup.
Set --fve-shell-sidebar-width on the bar or its containing region to match the consumer-owned sidebar. The brand region defaults to 15rem and appears at wide shell sizes.
API reference
module PageTopBarDsl =
val fvePageTopBar : ComponentElementBuilder
val fvePageTopBarBrand : ComponentElementBuilder
val fvePageTopBarActions : ComponentElementBuilder