DocsCloud UI BusinessAppShell

AppShell

A main application shell component that provides a layout structure with a collapsible sidebar navbar, banner support, and main content area.

Import

import { AppShell, AppPageShell } from '@tidbcloud/uikit/biz'

Basic Usage

import { AppShell, AppPageShell } from '@tidbcloud/uikit/biz'
 
function Demo() {
  return (
    <AppShell
      navbar={{
        logo: <img src="/logo.svg" alt="Logo" />
      }}
    >
      <AppShell.NavMenuPortal>
        <AppShell.NavItem label="Dashboard" href="/dashboard" />
        <AppShell.NavItem label="Settings" href="/settings" />
      </AppShell.NavMenuPortal>
 
      <AppPageShell title="Dashboard">
        <p>Page content here</p>
      </AppPageShell>
    </AppShell>
  )
}

With Banner

import { AppShell, AppPageShell } from '@tidbcloud/uikit/biz'
import { Alert } from '@tidbcloud/uikit'
 
function Demo() {
  return (
    <AppShell
      banner={<Alert color="blue">New features available!</Alert>}
      navbar={{
        logo: <img src="/logo.svg" alt="Logo" />
      }}
    >
      <AppPageShell title="Home">Content</AppPageShell>
    </AppShell>
  )
}
import { AppShell } from '@tidbcloud/uikit/biz'
import { IconHome, IconSettings } from '@tabler/icons-react'
 
function Demo() {
  return (
    <AppShell navbar={{ logo: <Logo /> }}>
      <AppShell.NavMenuPortal>
        <AppShell.NavItem label="Dashboard" href="/dashboard" leftSection={<IconHome size={16} />} />
        <AppShell.NavItem label="Settings" href="/settings" leftSection={<IconSettings size={16} />}>
          <AppShell.NavSubItem label="General" href="/settings/general" />
          <AppShell.NavSubItem label="Security" href="/settings/security" />
        </AppShell.NavItem>
      </AppShell.NavMenuPortal>
 
      <AppShell.NavFooterPortal>
        <AppShell.NavFooterItem label="Help" href="/help" />
      </AppShell.NavFooterPortal>
    </AppShell>
  )
}

Collapse Events

import { AppShell } from '@tidbcloud/uikit/biz'
 
function Demo() {
  return (
    <AppShell
      navbar={{
        logo: <Logo />,
        onCollapse: () => console.log('Navbar collapsed'),
        onExpand: () => console.log('Navbar expanded')
      }}
    >
      {/* content */}
    </AppShell>
  )
}

AppShell Props

PropTypeDefaultDescription
bannerReactNode-Banner displayed at the top
navbarobject-Navbar configuration object
PropTypeDefaultDescription
navbar.widthnumber240Custom width of the navbar
navbar.logoReactNode-Logo displayed in navbar header
navbar.headerLeftSectionReactNode-Left section of navbar header
navbar.menuTopReactNode-Content between header and menu
navbar.footerReactNode-Footer section of navbar
navbar.onLogoClick() => void-Callback when logo is clicked
navbar.onCollapse() => void-Callback when navbar collapses
navbar.onExpand() => void-Callback when navbar expands

Sub-components

ComponentDescription
AppShell.NavMenuPortalPortal for nav menu items
AppShell.NavItemBase navigation item
AppShell.NavSubItemSub-navigation item
AppShell.NavFooterPortalPortal for footer items
AppShell.NavFooterItemFooter navigation item
AppShell.ExpandButtonPlaceholderPlaceholder for expand button

AppPageShell

Page-level shell component designed to work within AppShell.

Basic Usage

import { AppPageShell } from '@tidbcloud/uikit/biz'
 
function Demo() {
  return (
    <AppPageShell title="Page Title">
      <p>Page content goes here</p>
    </AppPageShell>
  )
}

With Back Button

import { AppPageShell } from '@tidbcloud/uikit/biz'
 
function Demo() {
  return (
    <AppPageShell title="Details" showBack onBack={() => window.history.back()}>
      <p>Detail content</p>
    </AppPageShell>
  )
}
import { AppPageShell } from '@tidbcloud/uikit/biz'
 
function Demo() {
  return (
    <AppPageShell title="Long Page" stickyHeader>
      {/* Long scrollable content */}
    </AppPageShell>
  )
}

AppPageShell Props

PropTypeDefaultDescription
maxWidthstring'1920px'Maximum width of the page
withHeaderbooleantrueWhether to show the header
titleReactNode-Page title
childrenReactNode-Page content
wrapperPropsobject-Props for the wrapper
stickyHeaderboolean-Whether header is sticky
showBackboolean-Show back button
onBack() => void-Back button click handler
bodyPropsobject-Props for body section