Skip to Content
TelamonJS

AdminTabs

ContentTabs wrapper with height-filling CSS for shell page layouts

ContentTabs wrapper for page layouts. Injects flex-1 min-h-0 (plus child selectors) so tab panels fill the remaining height of a ShellPage — essential for maps and other viewport-filling content. ContentTabs itself is not modified; dialogs keep using it directly.

import { ShellPage, AdminHeader, AdminTabs } from '@telamonjs/ui'
import { useTabUrlSync } from '@telamonjs/ui'

const tabDefs = [
  { value: 'overview', label: 'Overview', icon: 'LayoutDashboard', content: <OverviewTab /> },
  { value: 'rules', label: 'Rules', icon: 'ListChecks', content: <RulesTab /> },
]

export default function AlertsPage() {
  const { activeTab, setTab } = useTabUrlSync({ tabs: tabDefs.map((t) => t.value) })

  return (
    <ShellPage>
      <AdminHeader title='Alerts' icon='Bell' />
      <AdminTabs tabs={tabDefs} value={activeTab} onValueChange={setTab} />
    </ShellPage>
  )
}

Props

PropTypeDefaultDescription
tabsTabItem[]-Tab definitions (value, label, shortLabel, icon, badge, content)
valuestring-Controlled active tab
onValueChange(value: string) => void-Tab change callback
fillHeightbooleantrueFill remaining height — use for full-height content like maps
compactbooleanfalseCompact tab sizing
variantContentTabsVariant'default'ContentTabs visual variant ('default' | 'underline' | 'pill' | 'glass' | 'gradient')
classNamestring-Extra classes

URL-Driven Tabs

Pair with useTabUrlSync so the URL is the source of truth (?tab=rules deep-links to a tab, and the browser Back button returns to the previous tab):

const { activeTab, setTab } = useTabUrlSync({ tabs: visibleDefs.map((d) => d.value) })

<AdminTabs tabs={tabs} value={activeTab} onValueChange={setTab} />

On this page