Skip to main content

ViewContent

The frame every view renders into: a title, toolbar actions, the content region, an optional bottom action bar and a breadcrumb trail.

Reach for it when a custom page should behave like a generated view — including inside a dialog, where the same component moves the title and the actions into the dialog chrome instead.

Example​

import {ViewContent} from 'habarico';

const OrderSummaryPage = () => (
<ViewContent
title="Order summary"
subtitle="Last 30 days"
toolbarActions={<RefreshOrdersButton />}
breadcrumbs={<OrderBreadcrumbs />}
>
<OrderSummary />
</ViewContent>
);

Props​

NameTypeDefaultDescription
children (required)ReactNode—The content region
titleReactNode—Portaled to the layout header, or to the dialog title
subtitleReactNode—Rendered under the title
toolbarActionsReactNode—Portaled next to the title
bottomActionsReactNode—A bottom ViewToolbar on a page, DialogActions in a dialog
breadcrumbsReactNode—Injected into the layout's breadcrumb slot
caution

ViewContent renders no card of its own. The visible paper surface is a per-view-type concern: a detail groups its content into Panels, and a list is wrapped in a ListSurface card by ListShell. A page that needs a card has to bring one.

Page or dialog​

Where each slot lands is read from ViewPresentationContext, never branched on by the caller:

SlotOn a pageIn a dialog or side panel
titleLayout header titleDialog title
toolbarActionsLayout header actionsDialog title actions
breadcrumbsLayout breadcrumb barNot rendered
bottomActionsIn-flow ViewToolbar footerDialogActions
childrenContent regionContent region

Breadcrumbs are suppressed in a dialog on purpose — a trail there would point at a page the user is not on.

See also​