Skip to content
Nana UI

Blocks

Dashboard

A whole dashboard from data: a sidebar with your brand, navigation and the signed-in user, a top bar, and a page header over your content. Pick the sidebar, floating or inset layout.

View .md Download

The dashboard shell is the frame of an app. Give it your brand, your navigation as data and the signed-in user, and it lays out the sidebar, the top bar and the page header. Your content goes underneath: stats, charts, tables, anything.

It installs as a block, so the code lands in your project and is yours to change.

Export New claim

Your content goes here: stats, charts and tables.

Overview

How the book is doing this month.

Premiums written
KES 4.2M
+12.5% from last month
Claims paid
KES 1.1M
−3.2% from last month
Active policies
1,284
+4.1% from last month
Open claims
38
12 waiting on documents

Premiums and claims

January to June 2026, KES thousands

  • Premiums
  • Claims paid
5 results
CoverStatus
CLM-2041Brian MwangiMotorKES 84,000In review
CLM-2040Faith AchiengMedicalKES 12,500Approved
CLM-2039Kevin OtienoMotorKES 230,000Documents
CLM-2038Grace WanjiruHomeKES 45,000Paid
CLM-2037Peter KamauMedicalKES 8,200Paid

Install the package for a versioned dependency:

npm install @nana-tec/ui-components

Or copy the source in and own it:

npx @nana-tec/ui add dashboard-shell --framework web-components
npx @nana-tec/ui add dashboard-shell --framework svelte

Lands in src/lib/blocks/dashboard-shell/, together with the sidebar, top bar, page header and avatar it is built from. Requires Tailwind v4.

The navigation is a list of groups. Each group has an optional label and its items; an item has a label, a link, an icon and, if you like, a badge, and it can hold one level of sub-items. Mark the current page with active.

<script lang="ts">
import { homeIcon, documentTextIcon } from '@nana-tec/ui-core/heroicons';
import { NanaDashboardShell, type DashboardNavGroup } from '$lib/blocks/dashboard-shell';
const nav: DashboardNavGroup[] = [
{
label: 'Workspace',
items: [
{ label: 'Overview', href: '/', icon: homeIcon, active: true },
{
label: 'Claims',
icon: documentTextIcon,
badge: 12,
items: [{ label: 'Motor', href: '/claims/motor' }],
},
],
},
];
</script>
<NanaDashboardShell
brand="Nana Insurance"
{nav}
user={{ name: 'Amina Otieno', detail: 'Claims lead' }}
heading="Overview"
>
{#snippet search()}<NanaInput type="search" aria-label="Search" />{/snippet}
{#snippet toolbar()}<NanaThemeToggle />{/snippet}
{#snippet actions()}<NanaButton>New claim</NanaButton>{/snippet}
<NanaStatsCards {stats} />
</NanaDashboardShell>

Import the autoloader once, in your app's entry point. Every <nana-*> tag then works anywhere, and each component downloads only the first time a page uses it:

import "@nana-tec/ui-components/autoloader";
import "@nana-tec/ui-components/theme";

The second line gives every component the Nana look and the design tokens behind it. Leave it out to style the components entirely yourself.

Import a component directly when it must be ready at once: on screen at first paint, or when you call its methods straight away. The two mix freely:

import "@nana-tec/ui-components/dashboard-shell";

Copied in with npx @nana-tec/ui add dashboard-shell? Import your project's own @/lib/nana-ui/autoloader.js once instead; the CLI keeps it up to date.

nav and user are data, so set them from script. Icons are names from the icon set.

<nana-dashboard-shell brand="Nana Insurance" heading="Overview">
<nana-input slot="search" type="search" aria-label="Search"></nana-input>
<nana-icon-button slot="toolbar" name="bell" label="Notifications"></nana-icon-button>
<nana-button slot="actions">New claim</nana-button>
<p>Your content</p>
</nana-dashboard-shell>
<script type="module">
const shell = document.querySelector('nana-dashboard-shell');
shell.nav = [
{
label: 'Workspace',
items: [
{ label: 'Overview', href: '/', icon: 'home', active: true },
{ label: 'Claims', icon: 'document-text', items: [{ label: 'Motor', href: '/claims/motor' }] },
],
},
];
shell.user = { name: 'Amina Otieno', detail: 'Claims lead' };
</script>
PlaceSvelte snippetWeb component slot
Brand mark, in place of the first lettermarkmark
Top bar, after the sidebar triggerbreadcrumbbreadcrumb
Middle of the top barsearchsearch
End of the top bartoolbartoolbar
Beside the page titleactionsactions
Sidebar footer, in place of the user cardfooterfooter
Under the page headerchildrendefault slot

variant picks how the sidebar sits beside the page, and collapsible how it folds away, just as on the sidebar. Everything else stays the same, so a layout change is one prop.

The sidebar blends into the background and the page sits in a raised, rounded panel.

Motor claims

Claims filed against motor policies, newest first.

Active policies
1,284
+4.1% from last month
Open claims
38
12 waiting on documents
5 results
CoverStatus
CLM-2041Brian MwangiMotorKES 84,000In review
CLM-2040Faith AchiengMedicalKES 12,500Approved
CLM-2039Kevin OtienoMotorKES 230,000Documents
CLM-2038Grace WanjiruHomeKES 45,000Paid
CLM-2037Peter KamauMedicalKES 8,200Paid

The sidebar floats as a card in a small gutter.

Claims

Every claim, across all covers.

5 results
CoverStatus
CLM-2041Brian MwangiMotorKES 84,000In review
CLM-2040Faith AchiengMedicalKES 12,500Approved
CLM-2039Kevin OtienoMotorKES 230,000Documents
CLM-2038Grace WanjiruHomeKES 45,000Paid
CLM-2037Peter KamauMedicalKES 8,200Paid

Charts first, the numbers underneath. The charts take their colours from the theme through the chart container.

Analytics

Premiums against claims over the half year.

Monthly totals

KES thousands

  • Premiums
  • Claims paid

Trend

KES thousands

  • Premiums
  • Claims paid
Premiums written
KES 4.2M
+12.5% from last month
Claims paid
KES 1.1M
−3.2% from last month
Active policies
1,284
+4.1% from last month
Open claims
38
12 waiting on documents

The shell fills the screen: the sidebar is as tall as the viewport and the page scrolls with the window. To fit it in a box of its own, such as a preview, let the page scroll inside the box instead.

.frame nana-dashboard-shell { height: 100%; }
.frame nana-dashboard-shell::part(layout) { height: 100%; min-height: 0; }
.frame nana-dashboard-shell::part(sidebar) { height: 100%; }
.frame nana-dashboard-shell::part(page) { min-height: 0; overflow: auto; }

The examples on this page wrap the shell in a frame that does this with Tailwind:

<div
class="h-[40rem] overflow-hidden [&_[data-nana=sidebar][data-part=root]]:h-full [&_[data-nana=sidebar][data-part=root]]:min-h-0 [&_[data-nana=sidebar][data-part=panel]]:h-full [&_main]:min-h-0 [&_main]:overflow-auto"
>
<NanaDashboardShell …>…</NanaDashboardShell>
</div>

Below 768px the sidebar opens as a drawer from the trigger in the top bar, the actions move under the page title, and the padding tightens.

  • The sidebar is a navigation landmark named by label, “Main” by default. Give each shell on a page its own name.
  • The page title is a level-one heading. Set level to 2 or 3 when the shell sits inside another page, as it does on this one.
  • Collapsed to icons, the brand and user names stay readable to screen readers, and each item’s label moves into a tooltip.

Properties

PropertyAttributeTypeDefaultDescription
brandbrandstring''The product or company name at the top of the sidebar.
brandHrefbrand-hrefstring''Where the brand links to, usually the dashboard's home.
collapsiblecollapsibleSidebarCollapsible'icon'How the sidebar collapses: icon, offcanvas or none.
descriptiondescriptionstring''A short line under the page title.
headingheadingstring''The page title.
labellabelstring'Main'Accessible name of the navigation.
levellevelnumber1Heading level of the page title: 1 for a page, 2 or 3 when the shell sits inside one.
nav—DashboardNavGroup[][]Navigation groups, each with an optional label and its items. An item may hold one level of sub-items.
openopenbooleantrueWhether the sidebar is expanded on a wide screen.
storageKeystorage-keystring''Remembers the expanded or collapsed state in localStorage under this key.
user—DashboardUser | undefined—The signed-in user, shown in the sidebar footer.
variantvariantSidebarVariant'sidebar'How the sidebar sits beside the page: sidebar, floating or inset.

Events

EventDescription
nana-toggleFired when the sidebar expands or collapses on a wide screen (detail.open)

Slots

SlotDescription
(default)The page content under the header
markThe brand's mark, in place of its first letter
breadcrumbA breadcrumb in the top bar, after the sidebar trigger
searchThe middle of the top bar, usually a search field
toolbarThe end of the top bar, such as notifications and a theme toggle
actionsThe page's buttons, beside the title
footerThe sidebar's footer, in place of the user card

CSS parts

PartDescription
::part(layout)The sidebar layout
::part(sidebar)The sidebar panel, exported from the layout
::part(page)The page beside the sidebar, exported from the layout
::part(brand)The brand at the top of the sidebar
::part(user)The user card in the sidebar footer
::part(top-bar)The top bar
::part(header)The page header
::part(body)The area holding the page header and the content

NanaDashboardBrand

PropType
namerequiredstring
hrefstring
markSnippet

NanaDashboardShell

PropTypeDefault
brandrequiredstring
brandHrefstring
navrequiredDashboardNavGroup[]
userDashboardUser
headingrequiredstring
descriptionstring
levelPageHeaderLevel1
variantSidebarVariant'sidebar'
collapsibleSidebarCollapsible'icon'
openbind:booleantrue
storageKeystring
labelstring'Main'
markSnippet
breadcrumbSnippet
searchSnippet
toolbarSnippet
actionsSnippet
footerSnippet
childrenSnippet

brand, nav and heading are required. user fills the sidebar footer. variant, collapsible, open (bindable), storageKey and label pass to the sidebar layout; description and level to the page header. brandHref links the brand.