Skip to content

Layout Modes

Trix Admin supports multiple layout modes to meet different interface requirements.

Layout Types

layoutType

The layoutType in route meta determines the layout used by the page:

ValueDescription
normalStandard layout, includes sidebar, header, tabs
blankBlank layout, no sidebar or header
typescript
{
  path: '/login',
  meta: {
    layoutType: 'blank'  // Login page uses blank layout
  }
}

Layout Modes

layout.mode

The layout.mode in theme configuration determines the menu position in standard layout:

ModeDescriptionUse Case
verticalLeft sidebar menuMany menu items
vertical-mixLeft mixed menuFirst-level on left, second-level on right
vertical-hybrid-header-firstLeft mixed - header firstFirst-level on top, second-level on left
horizontalTop menuFew menu items
top-hybrid-sidebar-firstTop mixed - sidebar firstFirst-level on left, second-level on top
top-hybrid-header-firstTop mixed - header firstBoth levels on top

vertical - Left Sidebar Menu

┌─────────────────────────────────────┐
│              Header                 │
├────────┬────────────────────────────┤
│        │           Tabs             │
│  Menu  ├────────────────────────────┤
│        │                            │
│        │          Content           │
│        │                            │
└────────┴────────────────────────────┘

horizontal - Top Menu

┌─────────────────────────────────────┐
│         Header + Menu               │
├─────────────────────────────────────┤
│              Tabs                   │
├─────────────────────────────────────┤
│                                     │
│             Content                 │
│                                     │
└─────────────────────────────────────┘

vertical-mix - Left Mixed

┌─────────────────────────────────────┐
│              Header                 │
├────┬───────┬────────────────────────┤
│    │       │         Tabs           │
│ 1  │   2   ├────────────────────────┤
│ st │  nd   │                        │
│    │       │        Content         │
│    │       │                        │
└────┴───────┴────────────────────────┘

Layout Configuration

Header Configuration

typescript
header: {
  height: 56,           // Header height
  inverted: false,      // Inverted colors
  breadcrumb: {
    visible: true,      // Show breadcrumb
    showIcon: true      // Show icon
  },
  multilingual: {
    visible: true       // Show language switch
  },
  globalSearch: {
    visible: true       // Show global search
  }
}
typescript
sider: {
  inverted: false,          // Inverted colors
  width: 220,               // Expanded width
  collapsedWidth: 64,       // Collapsed width
  mixWidth: 90,             // Mixed mode first-level menu width
  mixCollapsedWidth: 64,    // Mixed mode collapsed width
  mixChildMenuWidth: 200,   // Mixed mode child menu width
  mixChildMenuBgColor: '#ffffff',  // Child menu background color
  autoSelectFirstMenu: false       // Auto select first menu
}

Tab Configuration

typescript
tab: {
  visible: true,            // Show tabs
  cache: true,              // Enable cache
  height: 44,               // Tab height
  mode: 'chrome',           // Tab style: chrome | button
  closeTabByMiddleClick: false  // Close with middle click
}
typescript
footer: {
  visible: true,    // Show footer
  fixed: false,     // Fixed footer
  height: 48,       // Footer height
  right: true       // Content align right
}

Scroll Mode

scrollMode

ValueDescription
contentContent area scrolls
wrapperEntire page scrolls
typescript
layout: {
  mode: 'vertical',
  scrollMode: 'content'
}

Fixed Header and Tabs

typescript
fixedHeaderAndTab: true  // Fix header and tabs

Layout Components

LayoutWrapper

Layout entry component, selects layout based on layoutType:

vue
<!-- src/layouts/index.vue -->
<template>
  <component :is="layoutComponent">
    <router-view />
  </component>
</template>

BaseLayout

Standard layout component, includes:

  • GlobalHeader - Global header
  • GlobalSider - Global sidebar
  • GlobalMenu - Global menu
  • GlobalTab - Global tabs
  • RouteView - Route view

BlankLayout

Blank layout, contains only route view.

Switching Layout in JSON Schema

json
{
  "com": "NSelect",
  "model": "$theme.layout.mode",
  "props": {
    "options": [
      { "label": "Left Menu", "value": "vertical" },
      { "label": "Top Menu", "value": "horizontal" },
      { "label": "Left Mixed", "value": "vertical-mix" }
    ]
  }
}

Responsive Layout

The system automatically adjusts layout based on screen width:

  • Mobile (< 768px): Auto collapse sidebar
  • Tablet (768px - 1024px): Optional collapse
  • Desktop (> 1024px): Full layout
json
{
  "com": "div",
  "if": "$app.isMobile",
  "children": "Mobile content"
}

Released under the MIT License