Skip to main content

Page

The primary container for business pages. Supports left/right aside panels, header, footer, action bar, and scrollable content.

VEF-specific component. Not part of Ant Design. Moved from @vef-framework-react/starter to @vef-framework-react/components in v2.1.6.

When to Use

  • Any standard business page that needs a consistent layout shell.
  • Pages with a left-side tree and right-side content area.
  • Pages that need a sticky header or footer.

Basic Usage

import { Page } from '@vef-framework-react/components';

export default function UserPage() {
return (
<Page>
<div>Main content</div>
</Page>
);
}

With Left Aside

import { Page } from '@vef-framework-react/components';

export default function UserPage() {
return (
<Page
leftAside={<DeptTree />}
leftAsideWidth={260}
>
<UserTable />
</Page>
);
}

Resizable Aside

<Page
leftAside={<DeptTree />}
leftAsideWidth={{ defaultWidth: 260, minWidth: 180, maxWidth: 400 }}
>
<UserTable />
</Page>
<Page
header={<PageTitle>Users</PageTitle>}
headerPosition="outside"
footer={<StatusBar />}
footerPosition="inside"
>
<UserTable />
</Page>

API

PropTypeDefaultDescription
marginbooleanfalseApply var(--vef-spacing-md) margin to the container
gapLengthvar(--vef-spacing-md)Gap between grid cells
leftAsideReactNodeLeft aside content
leftAsideWidthAsideWidth280Fixed width or resizable config
rightAsideReactNodeRight aside content
rightAsideWidthAsideWidth280Fixed width or resizable config
headerReactNodeHeader content
headerPosition'inside' | 'outside''inside''outside' spans full width including asides
footerReactNodeFooter content
footerPosition'inside' | 'outside''inside''outside' spans full width including asides
actionBarReactNodeAction bar content
scrollablebooleanWhether main content is scrollable
scrollMarginbooleanfalseAuto margin for scrollbar spacing (requires scrollable)

AsideWidth

type AsideWidth = string | number | {
defaultWidth?: string | number;
minWidth?: string | number;
maxWidth?: string | number;
};

useViewportHeight

A hook exported alongside Page for calculating available viewport height:

import { useViewportHeight } from '@vef-framework-react/components';

const height = useViewportHeight();