Search the documentation

Type to search page titles, component names and descriptions.

    Page Patterns

    WorkspacePage

    An operational canvas: flow, board or master-detail.

    import { WorkspacePage } from 'faifo-design'

    WorkspacePage is one operational canvas. In flow mode metrics, process state and exception lists sit on one grey canvas; in canvas mode the main content scrolls horizontally without changing the shell; with a master it becomes a queue beside the item being worked on.

    #When to use

    • Use it for spatial or master-detail work: boards, schedules, reconciliation queues.
    • Each item of a queue keeps its own URL.
    • The split wraps by the space available, not by a viewport breakpoint.

    #Examples

    Each example is a specimen of the package catalogue, rendered on the server exactly as shown in its code.

    #Flow workspace

    A vertical operations overview where metrics, process state and exception lists sit on one grey canvas.

    Acme · Main branch
    Sales / Overview

    Revenue operations

    Quotations

    24

    5 new today

    Sent

    9

    Awaiting reply

    Confirmed

    18

    82,000,000 ₫

    Blocked

    2

    Needs attention

    Sales flow

    1. Quotation24
    2. Sent9
    3. Confirmed18
    4. To invoice6

    Exceptions

    OrderCustomerTotalState
    Ready to invoice2
    SO-1042Công ty Ánh Dương18.450.000 ₫Ready
    SO-1041Khách sạn Mùa Hạ6.800.000 ₫Review
    2 shown in Ready
    Needs decision1
    SO-1039Nguyễn Minh Châu2.150.000 ₫Blocked
    Show codeHide code
    import { JSXChild, TemplateResult } from '@ketvietlab/ketjs-view'
    import { ActionGroup, AppBrand, AppNavigation, AppShell, AppTopbar, Badge, Button, DataTable, Grid, Icon, LinkButton, Metric, NavigationToggle, Pipeline, Progress, Stack, Surface, WorkspacePage } from 'faifo-design'
    // exampleApplications: a catalogue fixture, packages/faifo-design/src/catalogue/application-switcher.ts
    
    type OrderRow = {
      id: string
      customer: string
      total: string
      state: 'Ready' | 'Review' | 'Blocked'
    }
    
    const orders: OrderRow[] = [
      { id: 'SO-1042', customer: 'Công ty Ánh Dương', total: '18.450.000 ₫', state: 'Ready' },
      { id: 'SO-1041', customer: 'Khách sạn Mùa Hạ', total: '6.800.000 ₫', state: 'Review' },
      { id: 'SO-1039', customer: 'Nguyễn Minh Châu', total: '2.150.000 ₫', state: 'Blocked' },
    ]
    
    const toneOf = (state: OrderRow['state']) =>
      state === 'Ready' ? ('positive' as const) : state === 'Review' ? ('warning' as const) : ('danger' as const)
    
    type DemoLayout = 'collection' | 'record' | 'flow' | 'canvas'
    
    const demoNavItems = (active: DemoLayout) => [
      {
        label: 'Collection',
        href: '#app-shell',
        leading: <Icon name="table" />,
        active: active === 'collection',
        count: 148,
      },
      { label: 'Record', href: '#record-page', leading: <Icon name="file-text" />, active: active === 'record' },
      {
        label: 'Flow',
        href: '#workspace-flow',
        leading: <Icon name="git-branch" />,
        active: active === 'flow',
        count: 7,
      },
      {
        label: 'Canvas',
        href: '#workspace-canvas',
        leading: <Icon name="layout-grid" />,
        active: active === 'canvas',
      },
    ]
    
    const DemoSidebar = (props: {
      id: string
      active: DemoLayout
      externalTrigger?: boolean
    }): TemplateResult => (
      <AppNavigation
        id={`demo-navigation-${props.id}`}
        externalTrigger={props.externalTrigger}
        label="Faifo workspace"
        identity={<AppBrand label="Faifo" href="#app-shell" />}
        context="Operations workspace"
        menuLabel="Workspace menu"
        tools={{
          searchLabel: 'Search menu',
          searchPlaceholder: 'Find a function…',
          emptyLabel: 'No matching function.',
          collapseLabel: 'Collapse menu',
        }}
        groups={[
          {
            id: `demo-primary-${props.active}`,
            label: 'Workspace',
            items: demoNavItems(props.active).map((item) => ({
              ...item,
              id: `${props.active}-${item.href.slice(1)}`,
            })),
          },
          {
            id: `demo-manage-${props.active}`,
            label: 'Manage',
            exclusive: false,
            items: [
              {
                id: `${props.active}-settings`,
                label: 'Settings',
                href: '#app-navigation',
                leading: <Icon name="settings" />,
              },
              {
                id: `${props.active}-reports`,
                label: 'Reports',
                expanded: true,
                leading: <Icon name="layout-dashboard" />,
                children: [
                  { id: `${props.active}-sales-report`, label: 'Sales', href: '#data-table', count: 7 },
                  {
                    id: `${props.active}-stock-report`,
                    label: 'Inventory',
                    href: '#metric',
                    leading: <Icon name="inbox" />,
                  },
                  {
                    id: `${props.active}-report-settings`,
                    label: 'Cấu hình',
                    expanded: true,
                    children: [
                      { id: `${props.active}-terms`, label: 'Điều khoản thanh toán', href: '#navigation-terms' },
                      {
                        id: `${props.active}-long-label`,
                        label: 'Phương thức thanh toán dành cho nhà cung cấp quốc tế',
                        href: '#navigation-long',
                      },
                    ],
                  },
                ],
              },
            ],
          },
        ]}
        footer="Signed in · Duy Kieu"
      />
    )
    
    const DemoRail = (props: {
      title: string
      detail: string
      progress?: number
      items?: readonly JSXChild[]
    }): TemplateResult => (
      <div data-ui="shell-demo-rail">
        <p data-ui="catalogue-kicker">Context</p>
        <strong>{props.title}</strong>
        <p>{props.detail}</p>
        {props.progress !== undefined && <Progress label={props.title} value={props.progress} />}
        {props.items !== undefined && <Stack gap="compact" items={props.items} />}
      </div>
    )
    
    const DemoShell = (props: {
      id: string
      active: DemoLayout
      main: JSXChild
      railTitle?: string
      railDetail?: string
      railProgress?: number
      railItems?: readonly JSXChild[]
    }): TemplateResult => (
      <AppShell
        applications={{
          ...exampleApplications,
          ...(exampleApplications.settings
            ? { settings: { ...exampleApplications.settings, id: `${props.id}-settings` } }
            : {}),
          items: [
            ...exampleApplications.items,
            { id: 'phone', label: 'Phone', icon: 'phone', unavailableLabel: 'Coming soon' },
            { id: 'chat', label: 'Chat', icon: 'message-circle', unavailableLabel: 'Coming soon' },
          ],
        }}
        mode="embedded"
        location={
          <AppTopbar
            location={<span>Acme · Main branch</span>}
            navigation={
              <NavigationToggle controls={`demo-navigation-${props.id}-drawer`} label="Open navigation" />
            }
            search={{
              id: `demo-global-search-${props.id}`,
              action: '#app-shell',
              triggerLabel: 'Search everywhere',
              closeLabel: 'Close',
              label: 'Global search',
              placeholder: 'Search…',
              submitLabel: 'Search',
            }}
          />
        }
        sidebar={<DemoSidebar id={props.id} active={props.active} />}
        main={props.main}
        rightRail={
          props.railTitle !== undefined ? (
            <DemoRail
              title={props.railTitle}
              detail={props.railDetail ?? ''}
              progress={props.railProgress}
              items={props.railItems}
            />
          ) : undefined
        }
      />
    )
    
    const OrdersTable = (props: { grouped?: boolean; title?: string } = {}): TemplateResult => (
      <DataTable
        title={props.title}
        rows={props.grouped ? ([] as OrderRow[]) : orders}
        id={(row) => row.id}
        rowHref={(row) => `#${row.id}`}
        responsive="stack"
        selection={{ selectedIds: ['SO-1042'] }}
        groups={
          props.grouped
            ? [
                {
                  id: 'ready',
                  label: 'Ready to invoice',
                  count: 2,
                  rows: orders.slice(0, 2),
                  pager: { label: '2 shown in Ready', nextHref: '#data-table' },
                },
                {
                  id: 'blocked',
                  label: 'Needs decision',
                  count: 1,
                  rows: orders.slice(2),
                },
              ]
            : undefined
        }
        columns={[
          {
            key: 'id',
            label: 'Order',
            cell: (row) => row.id,
            priority: 'primary',
            kind: 'identifier',
            sort: { href: '#data-table', direction: 'descending' },
          },
          { key: 'customer', label: 'Customer', cell: (row) => row.customer },
          { key: 'total', label: 'Total', cell: (row) => row.total, align: 'end', kind: 'currency' },
          {
            key: 'state',
            label: 'State',
            cell: (row) => <Badge label={row.state} tone={toneOf(row.state)} />,
            kind: 'status',
          },
        ]}
      />
    )
    
    export const Example = () => (
      <DemoShell
        id="workspace-flow"
        active="flow"
        main={
          <WorkspacePage
            variant="operational"
            layout="flow"
            context="Sales / Overview"
            title="Revenue operations"
            actions={<Button label="Create quotation" variant="primary" />}
            controls={
              <ActionGroup
                label="Flow controls"
                actions={[
                  <LinkButton label="Today" href="#workspace-flow" size="compact" />,
                  <LinkButton
                    label="This week"
                    href="#workspace-flow"
                    size="compact"
                    variant="tertiary"
                  />,
                ]}
              />
            }
            body={
              <Stack
                gap="loose"
                items={[
                  <Grid
                    columns={4}
                    items={[
                      <Metric label="Quotations" value={24} detail="5 new today" />,
                      <Metric label="Sent" value={9} detail="Awaiting reply" tone="info" />,
                      <Metric label="Confirmed" value={18} detail="82,000,000 ₫" tone="positive" />,
                      <Metric label="Blocked" value={2} detail="Needs attention" tone="danger" />,
                    ]}
                  />,
                  <Surface
                    title="Sales flow"
                    body={
                      <Pipeline
                        label="Sales flow"
                        steps={[
                          { id: 'draft', label: 'Quotation', value: 24 },
                          { id: 'sent', label: 'Sent', value: 9, tone: 'info' },
                          { id: 'confirmed', label: 'Confirmed', value: 18, tone: 'positive' },
                          { id: 'invoice', label: 'To invoice', value: 6, tone: 'warning' },
                        ]}
                      />
                    }
                  />,
                  <OrdersTable grouped title="Exceptions" />,
                ]}
              />
            }
          />
        }
        railTitle="Daily target"
        railDetail="56 of 82 confirmed orders have been invoiced today."
        railProgress={68}
      />
    )

    #Canvas workspace

    A horizontal board-style surface where the main content can scroll without changing the shell.

    Acme · Main branch
    CRM / Pipeline

    Opportunities board

    Qualified

    Mùa Hạ Riverside

    Needs proposal
    42,000,000 ₫

    Ánh Dương Group

    Demo booked
    18,000,000 ₫

    Proposal

    Lotus Hotels

    Awaiting CFO
    64,000,000 ₫

    Bình Minh Retail

    Legal review
    30,000,000 ₫

    Negotiation

    Sông Xanh

    Discount requested
    52,000,000 ₫

    Urban Stay

    Close this week
    40,000,000 ₫
    Show codeHide code
    import { JSXChild, TemplateResult } from '@ketvietlab/ketjs-view'
    import { AppBrand, AppNavigation, AppShell, AppTopbar, Badge, Button, ContentCard, Grid, Icon, Inline, LinkButton, NavigationToggle, Progress, Section, Stack, Tag, WorkspacePage } from 'faifo-design'
    // exampleApplications: a catalogue fixture, packages/faifo-design/src/catalogue/application-switcher.ts
    
    type DemoLayout = 'collection' | 'record' | 'flow' | 'canvas'
    
    const demoNavItems = (active: DemoLayout) => [
      {
        label: 'Collection',
        href: '#app-shell',
        leading: <Icon name="table" />,
        active: active === 'collection',
        count: 148,
      },
      { label: 'Record', href: '#record-page', leading: <Icon name="file-text" />, active: active === 'record' },
      {
        label: 'Flow',
        href: '#workspace-flow',
        leading: <Icon name="git-branch" />,
        active: active === 'flow',
        count: 7,
      },
      {
        label: 'Canvas',
        href: '#workspace-canvas',
        leading: <Icon name="layout-grid" />,
        active: active === 'canvas',
      },
    ]
    
    const DemoSidebar = (props: {
      id: string
      active: DemoLayout
      externalTrigger?: boolean
    }): TemplateResult => (
      <AppNavigation
        id={`demo-navigation-${props.id}`}
        externalTrigger={props.externalTrigger}
        label="Faifo workspace"
        identity={<AppBrand label="Faifo" href="#app-shell" />}
        context="Operations workspace"
        menuLabel="Workspace menu"
        tools={{
          searchLabel: 'Search menu',
          searchPlaceholder: 'Find a function…',
          emptyLabel: 'No matching function.',
          collapseLabel: 'Collapse menu',
        }}
        groups={[
          {
            id: `demo-primary-${props.active}`,
            label: 'Workspace',
            items: demoNavItems(props.active).map((item) => ({
              ...item,
              id: `${props.active}-${item.href.slice(1)}`,
            })),
          },
          {
            id: `demo-manage-${props.active}`,
            label: 'Manage',
            exclusive: false,
            items: [
              {
                id: `${props.active}-settings`,
                label: 'Settings',
                href: '#app-navigation',
                leading: <Icon name="settings" />,
              },
              {
                id: `${props.active}-reports`,
                label: 'Reports',
                expanded: true,
                leading: <Icon name="layout-dashboard" />,
                children: [
                  { id: `${props.active}-sales-report`, label: 'Sales', href: '#data-table', count: 7 },
                  {
                    id: `${props.active}-stock-report`,
                    label: 'Inventory',
                    href: '#metric',
                    leading: <Icon name="inbox" />,
                  },
                  {
                    id: `${props.active}-report-settings`,
                    label: 'Cấu hình',
                    expanded: true,
                    children: [
                      { id: `${props.active}-terms`, label: 'Điều khoản thanh toán', href: '#navigation-terms' },
                      {
                        id: `${props.active}-long-label`,
                        label: 'Phương thức thanh toán dành cho nhà cung cấp quốc tế',
                        href: '#navigation-long',
                      },
                    ],
                  },
                ],
              },
            ],
          },
        ]}
        footer="Signed in · Duy Kieu"
      />
    )
    
    const DemoRail = (props: {
      title: string
      detail: string
      progress?: number
      items?: readonly JSXChild[]
    }): TemplateResult => (
      <div data-ui="shell-demo-rail">
        <p data-ui="catalogue-kicker">Context</p>
        <strong>{props.title}</strong>
        <p>{props.detail}</p>
        {props.progress !== undefined && <Progress label={props.title} value={props.progress} />}
        {props.items !== undefined && <Stack gap="compact" items={props.items} />}
      </div>
    )
    
    const DemoShell = (props: {
      id: string
      active: DemoLayout
      main: JSXChild
      railTitle?: string
      railDetail?: string
      railProgress?: number
      railItems?: readonly JSXChild[]
    }): TemplateResult => (
      <AppShell
        applications={{
          ...exampleApplications,
          ...(exampleApplications.settings
            ? { settings: { ...exampleApplications.settings, id: `${props.id}-settings` } }
            : {}),
          items: [
            ...exampleApplications.items,
            { id: 'phone', label: 'Phone', icon: 'phone', unavailableLabel: 'Coming soon' },
            { id: 'chat', label: 'Chat', icon: 'message-circle', unavailableLabel: 'Coming soon' },
          ],
        }}
        mode="embedded"
        location={
          <AppTopbar
            location={<span>Acme · Main branch</span>}
            navigation={
              <NavigationToggle controls={`demo-navigation-${props.id}-drawer`} label="Open navigation" />
            }
            search={{
              id: `demo-global-search-${props.id}`,
              action: '#app-shell',
              triggerLabel: 'Search everywhere',
              closeLabel: 'Close',
              label: 'Global search',
              placeholder: 'Search…',
              submitLabel: 'Search',
            }}
          />
        }
        sidebar={<DemoSidebar id={props.id} active={props.active} />}
        main={props.main}
        rightRail={
          props.railTitle !== undefined ? (
            <DemoRail
              title={props.railTitle}
              detail={props.railDetail ?? ''}
              progress={props.railProgress}
              items={props.railItems}
            />
          ) : undefined
        }
      />
    )
    
    export const Example = () => (
      <DemoShell
        id="workspace-canvas"
        active="canvas"
        main={
          <WorkspacePage
            variant="operational"
            layout="canvas"
            context="CRM / Pipeline"
            title="Opportunities board"
            actions={<Button label="Create opportunity" variant="primary" />}
            controls={
              <Inline
                items={[
                  <LinkButton label="My pipeline" href="#workspace-canvas" size="compact" />,
                  <LinkButton
                    label="All teams"
                    href="#workspace-canvas"
                    size="compact"
                    variant="tertiary"
                  />,
                  <Tag label="High value" removeHref="#workspace-canvas" removeLabel="Remove filter" />,
                ]}
              />
            }
            body={
              <Grid
                columns={3}
                items={[
                  <Section
                    title="Qualified"
                    body={
                      <Stack
                        gap="compact"
                        items={[
                          <ContentCard
                            title="Mùa Hạ Riverside"
                            meta="42,000,000 ₫"
                            body="Needs proposal"
                          />,
                          <ContentCard title="Ánh Dương Group" meta="18,000,000 ₫" body="Demo booked" />,
                        ]}
                      />
                    }
                  />,
                  <Section
                    title="Proposal"
                    body={
                      <Stack
                        gap="compact"
                        items={[
                          <ContentCard title="Lotus Hotels" meta="64,000,000 ₫" body="Awaiting CFO" />,
                          <ContentCard
                            title="Bình Minh Retail"
                            meta="30,000,000 ₫"
                            body="Legal review"
                          />,
                        ]}
                      />
                    }
                  />,
                  <Section
                    title="Negotiation"
                    body={
                      <Stack
                        gap="compact"
                        items={[
                          <ContentCard title="Sông Xanh" meta="52,000,000 ₫" body="Discount requested" />,
                          <ContentCard title="Urban Stay" meta="40,000,000 ₫" body="Close this week" />,
                        ]}
                      />
                    }
                  />,
                ]}
              />
            }
          />
        }
        railTitle="Pipeline risk"
        railDetail="Three opportunities need owner follow-up before Friday."
        railItems={[
          <Badge label="2 overdue" tone="danger" />,
          <Badge label="6 due this week" tone="warning" />,
        ]}
      />
    )

    #Master-detail workspace

    A queue beside the item being worked on: ResourceList marks the open item with currentId; the split wraps when the detail would drop below 60% or 38rem.

    Show codeHide code
    import { ResourceList, Surface, WorkspacePage } from 'faifo-design'
    
    type OrderRow = {
      id: string
      customer: string
      total: string
      state: 'Ready' | 'Review' | 'Blocked'
    }
    
    const orders: OrderRow[] = [
      { id: 'SO-1042', customer: 'Công ty Ánh Dương', total: '18.450.000 ₫', state: 'Ready' },
      { id: 'SO-1041', customer: 'Khách sạn Mùa Hạ', total: '6.800.000 ₫', state: 'Review' },
      { id: 'SO-1039', customer: 'Nguyễn Minh Châu', total: '2.150.000 ₫', state: 'Blocked' },
    ]
    
    export const Example = () => (
      <WorkspacePage
        title="Bank reconciliation"
        variant="operational"
        masterLabel="Unmatched transactions"
        master={
          <ResourceList
            label="Unmatched transactions"
            rows={orders}
            id={(row) => row.id}
            href={(row) => `?id=${row.id}`}
            primary={(row) => `${row.id} · ${row.total}`}
            secondary={(row) => row.customer}
            currentId="SO-1042"
          />
        }
        body={
          <Surface title="SO-1042" body="Candidates, allocation and the difference for the open item." />
        }
      />
    )

    #API

    Generated from the package source. A property without a description has none in the source yet.

    #WorkspacePageComponent

    One operational canvas, with flow and horizontal-canvas layout modes.

    PropertyDescriptionTypeDefault
    titlerequired–string–
    bodyrequired–JSXChild–
    context–JSXChild–
    variant–'operational'–
    layoutVertical work surfaces use flow; boards, timelines and maps use canvas.'flow' | 'canvas'–
    eyebrow–string | null–
    status–JSXChild–
    meta–JSXChild–
    actions–JSXChild–
    controls–JSXChild–
    masterMaster-detail: the items to work through (usually a ResourceList with currentId), shown beside body, which works on the current one. Side by side while the detail keeps more than 60% of the width and the 38rem a table needs; stacked, master first, when it would not.JSXChild–
    masterLabelNames the master region, e.g. "Unmatched transactions". Required with master.string–

    #Types

    #WorkspacePageProps

    The properties of WorkspacePage, listed above.

    #Hooks

    The data-ui values these components render. Select them in tests and behaviour; their look belongs to the design system. See Contract.

    • workspace-page
    • workspace-page-context
    • workspace-page-header
    • workspace-page-heading
    • workspace-page-eyebrow
    • workspace-page-title-row
    • workspace-page-title
    • workspace-page-subline
    • workspace-page-status
    • workspace-page-actions
    • workspace-page-meta
    • workspace-page-toolbar
    • workspace-page-controls
    • workspace-page-body