dentil

Dashboard Layout

DashboardContainer lays out a dashboard page edge to edge: a header, section headers, a chart grid and tables, each bringing its own padding. Bordered blocks share their edges instead of doubling them.

@dentil/dashboard-layout
On this page

Billing

Overview

Revenue
£548,866.62
+13.5%
£483,611.70 previous period
Last updated 14:18
Subscriptions by plan
Today
2,285
  • Free
    1,284
  • Starter
    642
  • Pro
    318
  • Enterprise
    41

Invoices

Installation

pnpm dlx shadcn@latest add @dentil/dashboard-layout
npx shadcn@latest add @dentil/dashboard-layout
yarn dlx shadcn@latest add @dentil/dashboard-layout
bunx --bun shadcn@latest add @dentil/dashboard-layout

Files land in components/dentil/dashboard-layout/. It has no shadcn dependencies and no client code, so it renders in a Server Component. asChild uses Radix Slot.

Usage

Put DashboardContainer straight inside your app shell's content area, with no padding. Headers and section bodies add 20px on each side, and tables run to the edge.

import {
  DashboardContainer,
  DashboardGrid,
  DashboardHeader,
  DashboardHeading,
  DashboardSection,
  DashboardSectionContent,
  DashboardSectionHeader,
  DashboardSubheading,
  DashboardTableHeader,
} from '@/components/dentil/dashboard-layout/dashboard-layout';

<DashboardContainer>
  <DashboardHeader>
    <DashboardHeading asChild>
      <h1>Billing</h1>
    </DashboardHeading>
    <Button>Create invoice</Button>
  </DashboardHeader>

  <DashboardSection>
    <DashboardSectionHeader>
      <DashboardSubheading>Overview</DashboardSubheading>
    </DashboardSectionHeader>
    <DashboardGrid>
      <DashboardSectionContent>
        <LineChart title="Revenue" … />
      </DashboardSectionContent>
      <DashboardSectionContent>
        <CategoryBarChart title="Subscriptions by plan" … />
      </DashboardSectionContent>
    </DashboardGrid>
  </DashboardSection>

  <DashboardTableHeader>
    <DashboardSubheading>Invoices</DashboardSubheading>
  </DashboardTableHeader>
  <DataTable … />
</DashboardContainer>

Borders

The blocks draw no outer border. Each child of DashboardContainer, DashboardSplit and its panes is pulled up and left by 1px, so a table's top border, a split's top border and the sidebar's left border land on the line before them instead of beside it. The container's -1px margin does the same against your shell, so a bordered child sits on the shell's edge.

Examples

Split

A record page: the main pane holds tables, and the sidebar holds details. They sit side by side from xl.

Ada Lovelace

Invoices

Details

Email
Currency
GBP
Balance
£0.00

Notes

Pays by bank transfer on the first of the month.

Give the container fixedHeight and a parent with a height, and each pane scrolls on its own.

<DashboardContainer fixedHeight>
  <DashboardHeader>
    <DashboardHeading>Ada Lovelace</DashboardHeading>
  </DashboardHeader>
  <DashboardSplit className="border-t">
    <DashboardSplitMain>…</DashboardSplitMain>
    <DashboardSplitSidebar>…</DashboardSplitSidebar>
  </DashboardSplit>
</DashboardContainer>

API reference

DashboardContainer

PropTypeDefaultDescription
fixedHeightbooleanfalseFills the parent's height instead of growing with the content. Use it with DashboardSplit so the main pane and sidebar scroll on their own. The parent needs a height.
classNamestring—Merged onto the container.
…propsComponentProps<'div'>—Other div props.

DashboardHeading and DashboardSubheading

PropTypeDefaultDescription
asChildbooleanfalseRenders the styles on the child, so you can pick the heading level, e.g. <DashboardHeading asChild><h1>Billing</h1></DashboardHeading>.
classNamestring—Merged onto the heading.

Parts

Every part takes className and the props of the element it renders, and sets a data-slot.

PropTypeDefaultDescription
DashboardHeaderdiv—Page title row: heading on the left, actions on the right. Stacks below sm. 20px side padding.
DashboardHeadingh3—Page title, 18px bold.
DashboardSubheadingh4—Section title for a section or table header, 16px bold.
DashboardGriddiv—One column, then two from xl. Rows size to their content.
DashboardSplitdiv—Main pane and sidebar, stacked until xl, then side by side. Pulls its panes together by 1px.
DashboardSplitMaindiv—The wide pane. Scrolls when the split has a height.
DashboardSplitSidebardiv—Full width when stacked, 384px from xl, with a left border. Scrolls when the split has a height.
DashboardSectionsection—Groups a section header with its content. No styles.
DashboardSectionHeaderdiv—Title row with a bottom border and 16px above it, 62px tall.
DashboardSectionContentdiv—Padded body: 20px sides, 16px top and bottom.
DashboardSectionTitlep—Small 14px label above a block in a section body.
DashboardTableHeaderdiv—Title row above a table, 61px tall, with no bottom border so the table's top border closes it. Its 16px top margin is !important, so it clears the block above even as a direct child of the container.