Skip to content

CdsPage

A page inside the layout: CdsPage gives the content a minimum height that accounts for the header and the footer, so a short page fills the whole screen instead of hanging as a narrow strip at the top.

Storybook GitLab
Test coverage: 100% — good coverage
API in specs
3 / 3 props, events, slots and exposed members with a test
Test cases
10 unit · 0 browser
Known bugs
1 pinned by an it.fails test
Code coverage
100% lines · 83.3% branches measured in v4.0.0-alpha.13
A11y (axe)
1 recommendations in 3 stories measured in v4.0.0-alpha.11

CdsPage lives inside CdsMain — outside it renders nothing and warns about it in the console. The paddings around the whole content area are calculated by CdsLayout.

Variations ​

Paddings ​

The padding prop adds inner paddings to the page — the usual layout for content screens. Without it the content sticks to the edges: that is how tables and maps that need the full width are laid out.

Custom height ​

The style-fn prop replaces the minimum height calculation with your own. The function receives the total height of the header and the footer and the height of the layout area, and returns a style string. This is how a page can be fixed in height and give the scrolling to an inner list or table.

Scenarios ​

A full-screen empty state ​

The minimum height accounts for the header and the footer, so the centering works against the real height of the page — the placeholder ends up exactly in the middle instead of right under the header.

API ​

Props

NameTypeDefaultDescription
paddingboolean | undefinedfalseAdds paddings to the page.
styleFn((offset: number, height: number) => string) | undefined—Function that computes the styles of the page. It receives the total offset (header + footer) and the height of the area, and returns a style string.

Slots

NameTypeDescription
defaultanyContent of the page.