component from react native.
import { ContainerVertical } from '@duik/it' ... const MyLayout = () => ( <div style={ { height: '400px' } }> {/* just to simulate viewport*/} <ContainerVertical> <div style={ { flexBasis: '70px', background: '#34ace0' } }> Top Bar </div> {/* we are adding flex-grow: 1 because we are inside flexbox element and we want to fill rest of the viewport height */} <div style={ { flexGrow: '1', background: '#ffb142' } }> Some content </div> </ContainerVertical> </div> )
Result:
The vertical split is done, let's cut down the bottom part of our layout like this:
For splitting the layout horizontaly, we can use ContainerHorizontal. It works the same way as ContainerVertical, just horizontaly.
import { ContainerVertical, ContainerHorizontal, } from '@duik/it' ... const MyLayout = () => ( <div style={ { height: '400px' } }> {/* just to simulate viewport*/} <ContainerVertical> <div style={ { flexBasis: '70px', background: '#34ace0' } }> Top Bar </div> <ContainerHorizontal> <div style={ { background: '#ff5252', flexBasis: '30%' } }> Menu </div> <div style={ { background: '#ffb142', flexBasis: '70%' } }> Main Content </div> </ContainerHorizontal> </ContainerVertical> </div> )
Result:
If you generally like the layout of the UI Kit, you can also use the predefined components to build the layout quickly. Here is an simple example, in which we will be using:
For splitting the layout horizontaly, we can use ContainerHorizontal. It works the same way as ContainerVertical, just horizontaly.
With very little code, you can build quite complex interface. Of course, you should split the code into multiple files!
<div style={{ background: 'var(--bg-base)', border: '1px solid var(--border-color-base)', height: '400px' }} > <ContainerVertical> <TopBar> <TopBarSection> <TopBarTitle> Dashboard </TopBarTitle> </TopBarSection> <TopBarSection> <TopBarLinkContainer> <TopBarLink> Menu item 1 </TopBarLink> <TopBarLink className="active" href="#"> Menu item 1 </TopBarLink> </TopBarLinkContainer> </TopBarSection> </TopBar> <ContainerHorizontal> <NavPanel> <NavSection> <NavSectionTitle> Menu </NavSectionTitle> <NavLink highlighted> Hello item </NavLink> <NavLink highlighted> Title for link </NavLink> </NavSection> </NavPanel> <ScrollArea> <WidgetContainer> <Widget padding> <h2> Title </h2> </Widget> </WidgetContainer> </ScrollArea> </ContainerHorizontal> </ContainerVertical> </div>