Components Workspace

WorkspaceLayout

Split, tabbed, resizable panels in a tree, as video and photo editors lay out their workspaces.

import { WorkspaceLayout } from '@kition/tessera-ui'

Examples

Editing workspace

Drag the gutters; drag tabs between groups.

workspace-layout.tsx
import { useState } from 'react'
import { WorkspaceLayout, type WorkspaceNode } from '@kition/tessera-ui'

const START: WorkspaceNode = {
  split: 'row',
  size: { ratio: 0.32 },
  a: { tabs: ['project', 'effects'], active: 0 },
  b: { split: 'column', size: { ratio: 0.6 }, a: { tabs: ['program'], active: 0 }, b: { tabs: ['timeline'], active: 0 } },
}

export default function Demo() {
  const [tree, setTree] = useState(START)
  const [focused, setFocused] = useState<string | null>('program')
  const [maximized, setMaximized] = useState<string | null>(null)
  const panel = (id: string, label: string) => ({ id, label, render: () => <div className="demo-pane">{label}</div> })
  return (
    <div style={{ height: 320 }}>
      <WorkspaceLayout
        tree={tree}
        onTree={setTree}
        panels={[panel('project', 'Project'), panel('effects', 'Effects'), panel('program', 'Program'), panel('timeline', 'Timeline')]}
        focused={focused}
        onFocus={setFocused}
        maximized={maximized}
        onMaximized={setMaximized}
        onRestore={() => setTree(START)}
      />
    </div>
  )
}

Props

WorkspaceLayout

PropTypeDefaultDescription
treerequiredWorkspaceNode—
onTreerequired(tree: WorkspaceNode) => void—
panelsrequiredreadonly WorkspacePanel[]—Keep this array, and each panel's render, stable across renders (see above).
focusedrequiredstring | null—
onFocusrequired(panel: string) => void—
maximizedrequiredstring | null—The maximized panel fills the area without changing the tree (upstream keys.maximized, the and Shift+ keys). The panel menu's Maximize Frame, as upstream, replaces the tree instead.
onMaximizedrequired(panel: string | null) => void—
onRestorerequired() => void—Restore Workspace in the panel menu.
testIdstring—

Used in

1 of Kition's 16 kits use this component.

  • Film