Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Containers

  • Layout
  • AdminLayout
  • SettingsLayout
  • ScrollArea
  • Viewport
  • Resizable
  • AspectRatio
  • FitScreen
  • PreviewSandbox
  • Masonry
  • Container
  • AccentScope

Arrangement

  • Stack
  • Grid
  • Spacer
  • Divider
  • Separator

Layout

layout

Composes full-page header, sider, content, and footer regions with a collapsible sider.

Usage

Classic middle and backend shell

Left Sider + Right Header / Content / Footer, automatic horizontal layout when including sidebar.

Hulian Console
Middle and backend shelluser@hulian

Page content

No. 1 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 2 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 3 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 4 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 5 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 6 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 7 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 8 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

Hulian Layout · © 2026
tsx
const [collapsed, setCollapsed] = useState(false)

<Layout className="h-full" hasSider>
  <Layout.Sider collapsible collapsed={collapsed} onCollapse={setCollapsed}>
    <div className={cn(
      "flex h-[var(--hl-layout-header-h)] items-center font-semibold",
      collapsed ? "justify-center" : "px-4",
    )}>
      {collapsed ? "H" : "Hulian Console"}
    </div>
    <NavMenu items={items} mode={collapsed ? "collapsed" : "inline"} selectedKeys={["dashboard"]} />
  </Layout.Sider>
  <Layout>
    <Layout.Header sticky>
      <span className="font-medium">Middle and backend shell</span>
      <span className="ml-auto text-sm text-muted-foreground">user@hulian</span>
    </Layout.Header>
    <Layout.Content>{/* Page content */}</Layout.Content>
    <Layout.Footer>Hulian Layout · © 2026</Layout.Footer>
  </Layout>
</Layout>

The header of the banner is at the top

Header spans the full width, and is divided into Sider + Content below. The outermost layer is a vertical layout.

Header of banner
Hulian Console

Page content

No. 1 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 2 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 3 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 4 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 5 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 6 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 7 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 8 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

Bottom bar · © 2026
tsx
<Layout className="h-full">
  <Layout.Header>
    <span className="font-medium">Bar header</span>
  </Layout.Header>
  <Layout>
    <Layout.Sider collapsible>
      <NavMenu items={items} />
    </Layout.Sider>
    <Layout.Content>{/* Page content */}</Layout.Content>
  </Layout>
  <Layout.Footer>Bottom bar · © 2026</Layout.Footer>
</Layout>

Close the sidebar by default

defaultCollapsed makes the sidebar initially retracted, and NavMenu switches to the collapsed icon track.

Hu
  • Dashboard
  • Workbench
  • User Management
  • System Settings
Collapse

Page content

No. 1 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 2 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 3 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 4 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 5 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 6 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 7 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 8 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

Hulian Layout · © 2026
tsx
<Layout.Sider collapsible defaultCollapsed>
  <NavMenu items={items} mode="collapsed" />
</Layout.Sider>

When to use

Use Layout when you need a general page skeleton with Header, Sider, Content, and Footer regions while retaining control of menu and tab behavior. For a ready-made admin shell with branding, NavMenu, and persistent multi-tab navigation, use AdminLayout, which is assembled from these primitives.

Import

ts
import { Layout, LayoutHeader, LayoutSider, LayoutContent, LayoutFooter } from "@hulianui/ui"

Props

Layout (also available through compound members such as Layout.Sider)

NameTypeDefaultDescription
hasSiderbooleanauto-detectedForces a horizontal layout containing a sidebar. By default, direct children are inspected for Layout.Sider: present means row, absent means column. Set this explicitly when the Sider is rendered asynchronously or conditionally.

Inherited from HTMLAttributes<HTMLDivElement>.

LayoutHeader

NameTypeDefaultDescription
stickybooleanfalseSticky top-0.

LayoutSider

NameTypeDefaultDescription
widthnumber240Expanded state width (px).
collapsedWidthnumber64Width in the collapsed state (px), typically for an icon-only menu.
collapsiblebooleanfalseEnables collapsing and displays the bottom trigger.
collapsedboolean-Controlled collapsed state. Pair it with onCollapse to update the value.
defaultCollapsedbooleanfalseInitial collapsed state when uncontrolled.
breakpoint"sm" | "md" | "lg" | "xl" | "2xl" | number-Responsive breakpoint: the viewport automatically collapses when ≤ the width, and expands when >.

LayoutContent / LayoutFooter

Accept standard HTMLAttributes<HTMLElement> and define no component-specific props.

Events

LayoutSider

EventTypeDescription
onCollapse(collapsed: boolean, type: "clickTrigger" | "responsive") => voidCollapse state change callback (triggered when trigger is clicked or breakpoint is hit).

Slots

LayoutSider

SlotTypeDescription
triggerReactNodeBottom collapse trigger. undefined uses the default chevron; null hides the trigger even when collapsible; a node supplies custom content inside the component's clickable button.

Example

tsx
// Classic shell: collapsible Sider on the left, page regions on the right
<Layout>
  <Layout.Sider collapsible>
    {/* Brand and menu */}
  </Layout.Sider>
  <Layout>
    <Layout.Header sticky>Top bar</Layout.Header>
    <Layout.Content>Content</Layout.Content>
    <Layout.Footer>Footer</Layout.Footer>
  </Layout>
</Layout>
tsx
// Controlled collapse: trigger and breakpoint changes update local state
function Shell() {
  const [collapsed, setCollapsed] = useState(false);
  return (
    <Layout.Sider
      collapsible
      collapsed={collapsed}
      breakpoint="md"
      onCollapse={(c) => setCollapsed(c)}
    >
      <NavMenu items={menu} mode={collapsed ? "collapsed" : "inline"} />
    </Layout.Sider>
  );
}

Usage guidelines

  • Layout.Sider owns the width, not the content. Whether the brand block shows a full name or a single glyph, and whether NavMenu runs in inline or collapsed mode, is up to you. So keep collapsed in your own state (controlled prop plus an onCollapse write-back) rather than passing a one-shot defaultCollapsed. With only an initial value, clicking the trigger still narrows the sider to 64px while its content stays expanded, and a multi-character label shrinks to min-content, stacking one glyph per line and inflating the header (#120). You can also read data-collapsed on the Sider root and drive it from CSS.
  • Header height comes from --hl-layout-header-h (4rem). To line up a sidebar logo block with the header (which nearly every app needs), use h-[var(--hl-layout-header-h)] on both instead of copying the number out of the source; getting it wrong leaves a divider that never lines up.
  • Choose controlled or uncontrolled state. Passing collapsed makes Layout.Sider controlled, so onCollapse must write changes back or the trigger and breakpoint cannot update it. Use defaultCollapsed only for uncontrolled state.
  • Layout direction is inferred from direct children. A direct Layout.Sider makes the parent horizontal. Detection cannot see a Sider rendered asynchronously, conditionally, or inside a wrapper such as <AppSider />; set hasSider explicitly in those cases.
  • In the collapsed state, pass mode="collapsed" to NavMenu for its built-in icon-only track. Do not hand-build truncated menu labels.

Related

AdminLayout · ScrollArea · Viewport · Resizable · AspectRatio · FitScreen

Playground

Hulian Console
Middle and backend shelluser@hulian

Page content

No. 1 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 2 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 3 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 4 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 5 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 6 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 7 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

No. 8 Segment occupancy content - Content area flex-auto is full and scrolls independently, Header can reach the top, and Footer can sink to the bottom.

Hulian Layout · © 2026
<Layout>
  <Layout.Sider collapsible>
    {/* dogfood NavMenu: Automatically cut the icon track in the collapsed state */}
    <NavMenu items={items} mode={"inline"} />
  </Layout.Sider>
  <Layout>
    <Layout.Header sticky>Top Bar</Layout.Header>
    <Layout.Content>Content</Layout.Content>
    <Layout.Footer>Bottom bar</Layout.Footer>
  </Layout>
</Layout>
LayoutNextAdminLayout

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Slots
    • Example
    • Usage guidelines
    • Related
  • Playground