PHP 8.2.30
Preview: tab.tsx Size: 848 B
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/@adminjs/design-system/src/atoms/tabs/tab.tsx

import React, { PropsWithChildren, useLayoutEffect } from 'react'

import { useTabs } from './tabs.jsx'

export interface TabProps extends PropsWithChildren {
  /**
   * ID of the Tab. It has to be a unique string
   */
  id: string
  /**
   * Title of the Tab that will be shown on the tab navigation bar.
   */
  label: string
}

/**
 * Renders children inside Tabs component. Each Tab will add a single tab in
 * the navigation bar.
 */
export const Tab: React.FC<TabProps> = ({ id, label, children }) => {
  const { currentTab, registerTab, unregisterTab } = useTabs()

  useLayoutEffect(() => {
    registerTab(id, label)
    return () => unregisterTab(id)
  })

  if (id !== currentTab) {
    return null
  }

  // eslint-disable-next-line react/jsx-no-useless-fragment
  return <>{children}</>
}

Tab.displayName = 'Tab'

export default Tab

Directory Contents

Dirs: 0 × Files: 4

Name Size Perms Modified Actions
53 B lrw-r--r-- 2026-02-28 00:31:46
Edit Download
848 B lrw-r--r-- 2026-02-28 00:32:00
Edit Download
704 B lrw-r--r-- 2026-02-28 00:32:00
Edit Download
4.35 KB lrw-r--r-- 2026-02-28 00:32:00
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).