Page
The Page
component provides the basic layout for your app with slots for a
header, sidebar, main content, and a detail view. The Main
slot is the only
slot that is mandatory for rendering the Page
; every other slot is optional.
Check out the UI and design guidelines for more information on how to structure your app using the page.
Import
import { Page } from '@dynatrace/strato-components-preview/layouts';
Use cases
Define responsive layouts
The page handles different screen sizes internally. On smaller screens, a drawer
is used for Sidebar
and DetailView
instead of rendering them next to the
Main
panel. You can configure the breakpoints to determine when to switch to
the drawer.
Default breakpoints:
DetailView
: tabletSidebar
: mobile
Controlling panel state
Use the dismissed
prop and onDismissChange
callback of the panels to control
the panel state yourself. The onDismissChange
is called every time a different
dismiss state is suggested with two arguments:
- The expected state
- The reason for the change
There are three reasons for such a change:
- The viewport width exceeds the breakpoint ('above breakpoint')
- The viewport width surpasses the breakpoint ('below breakpoint')
- The drawer was dismissed by user interaction, either pressing
Escape
('escape') or clicking on the backdrop ('backdrop')
Set minimum panel width
To avoid panels shrinking below a certain value, you can set the minWidth
.
If you provide a
minWidth
bigger than thepreferredWidth
, the minimum width overrides the preferred width.
If the combined minimum width of all panels exceeds the viewport width, the page will have a horizontal scrollbar. Make sure to provide reasonable breakpoints (see the define responsive layouts section) if you want to avoid having a horizontal scroll.
Save & restore panel sizes
To restore the panel sizes, you can utilize e.g. the localStorage
. Resize the
panels in the page below and use the buttons to toggle between pages or reload
the page to see this in effect.