Layout Component Examples

The Layout component is a versatile container that can be configured for various use cases. Below are examples of common layout patterns implemented with SappsUI components.

Login Layout

A simple layout without navbar or sidebar, perfect for authentication pages.

Implementation

<Layout>
  <LayoutBody>
    <LayoutMain>
      <!-- Page content -->
    </LayoutMain>
  </LayoutBody>
</Layout>

Landing Page Layout

A layout with only a navbar, commonly used for landing pages and marketing sites.

Implementation

<Layout hNavbar={64} navbarInset>
  <Navbar>
    <NavbarBody>
      <!-- Navbar content -->
    </NavbarBody>
  </Navbar>
  <LayoutBody>
    <LayoutMain>
      <!-- Page content -->
    </LayoutMain>
  </LayoutBody>
</Layout>

Dashboard Layout

A complete layout with navbar and sidebar, ideal for dashboards and admin panels. The sidebar is responsive and becomes a drawer on mobile devices based on the breakpoint.

Implementation

<Layout hNavbar={64} wlSidebar={200} navbarInset>
  <Navbar>
    <NavbarBody>
      <!-- Navbar content with menu toggle for mobile -->
    </NavbarBody>
  </Navbar>
  <LayoutBody>
    <Sidebar breakpoint="md">
      <SidebarBody>
        <!-- Sidebar content -->
      </SidebarBody>
    </Sidebar>
    <LayoutMain>
      <!-- Main content -->
    </LayoutMain>
  </LayoutBody>
</Layout>

Additional Layout Configurations

The Layout component supports various configurations through props:

PropDescriptionExample
hNavbarHeight of the navbar in pixelshNavbar=64
hDockHeight of the dock in pixelshDock=56
wlSidebarWidth of the left sidebar in pixelswlSidebar=250
wrSidebarWidth of the right sidebar in pixelswrSidebar=250
navbarInsetWhether to inset the layout body below the navbarnavbarInset=true
fullOnScrollWhether to hide the navbar when scrolling downfullOnScroll=true

Responsive Behavior

The sidebar component has a breakpoint prop that determines when it transforms into a drawer on smaller screens. Common breakpoint values are: "sm", "md", "lg", "xl", "2xl".

Resize your browser window to see how the dashboard example above changes between sidebar and drawer modes.