Layout

Layout UI Component

Demo

Installation

npm i @synerise/ds-layout
or
yarn add @synerise/ds-layout
import Layout from '@synerise/ds-layout'
<Layout
header={<HeaderComponent />}
left={{content: <LeftSidebarComponent />, opened: true, onChange: () => {}}}
right={{content: <RightSidebarComponent />, opened: false, onChange: () => {}}}
className={layoutClass}
>
<Content />
<Layout />

API

PropertyDescriptionTypeDefault
headerSet top header content pageReact.ReactNode
subheaderSet subheader content pageReact.ReactNode
leftConfiguration of left sidebarSidebarProps
rightConfiguration of right sidebarSidebarProps
childrenThe layout elements passed to the parentReact.ReactNode
classNameLayout's classNamestring
stylesCustom layout stylesLayoutStyles
leftOpenedWhether left sidebar is openedbooleanfalse
rightOpenedWhether right sidebar is openedbooleanfalse
leftOpenedWidthWidth of opened left sidebarnumber320
rightOpenedWidthWidth of opened right sidebarnumber320
renderLeftSidebarControlsLeft sidebar visibility. Accepts function returning ReactNode.boolean or functionfalse
renderRightSidebarControlsRight sidebar visibility. Accepts function returning ReactNode.boolean or functionfalse
leftSidebarWithDndSet withDnd in left sidebar scrollbarbooleanfalse
mainSidebarWithDndSet withDnd in main sidebar scrollbarbooleanfalse
rightSidebarWithDndSet withDnd in right sidebar scrollbarbooleanfalse
nativeScrollSet main column to use native browser scrollbooleanfalse
nativeScrollRefref to pass to scrollable elementRef<HTMLDivElement>-
fillViewportsets layout to absolute with calc(100vh - viewportTopOffset) heightbooleanfalse
viewportTopOffsettop viewport offset (if fillViewport is true)number55

SidebarProps

PropertyDescriptionTypeDefault
openedWheter sidebar is openedbooleanfalse
onChangeCallback fired when user clicks the sidebar button(isOpened: boolean) => void-
contentContent of sidebarReact.ReactNode-
widthWidth of opened sidebarnumber320

LayoutStyles

PropertyDescriptionTypeDefault
leftStyles of left componentReact.CSSProperties-
leftInnerStyles of left inner componentReact.CSSProperties-
mainStyles of main componentReact.CSSProperties-
mainInnerStyles of main inner componentReact.CSSProperties-
rightStyles of right componentReact.CSSProperties-
rightInnerStyles of right inner componentReact.CSSProperties-