Home / File/ TabBar.js — react Source File

TabBar.js — react Source File

Architecture documentation for TabBar.js, a javascript file in the react codebase. 5 imports, 3 dependents.

File javascript BabelCompiler Validation 5 imports 3 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  1356ba82_c85f_323e_8c5f_e616c171f6ad["TabBar.js"]
  21af3248_c15c_a61c_1f5b_7409a91b945c["Icon.js"]
  1356ba82_c85f_323e_8c5f_e616c171f6ad --> 21af3248_c15c_a61c_1f5b_7409a91b945c
  f23861b1_8332_6fa9_2862_ddd6110f3776["Icon"]
  1356ba82_c85f_323e_8c5f_e616c171f6ad --> f23861b1_8332_6fa9_2862_ddd6110f3776
  ec4ae88e_c0b3_6086_4115_0e24748d9b82["TabBar.css"]
  1356ba82_c85f_323e_8c5f_e616c171f6ad --> ec4ae88e_c0b3_6086_4115_0e24748d9b82
  bb73063d_5d08_efb3_036e_72b78842d689["tooltip.js"]
  1356ba82_c85f_323e_8c5f_e616c171f6ad --> bb73063d_5d08_efb3_036e_72b78842d689
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  1356ba82_c85f_323e_8c5f_e616c171f6ad --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  e2c52a93_982e_407f_9fee_e89aa134ae9d["DevTools.js"]
  e2c52a93_982e_407f_9fee_e89aa134ae9d --> 1356ba82_c85f_323e_8c5f_e616c171f6ad
  2e59ff66_9c56_6e37_8843_8e474e6b0d70["Profiler.js"]
  2e59ff66_9c56_6e37_8843_8e474e6b0d70 --> 1356ba82_c85f_323e_8c5f_e616c171f6ad
  33c9bb39_5afe_7433_b39c_5c97384e3323["SettingsModal.js"]
  33c9bb39_5afe_7433_b39c_5c97384e3323 --> 1356ba82_c85f_323e_8c5f_e616c171f6ad
  style 1356ba82_c85f_323e_8c5f_e616c171f6ad fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import * as React from 'react';
import {Fragment, useCallback} from 'react';
import Icon from './Icon';

import styles from './TabBar.css';
import Tooltip from './Components/reach-ui/tooltip';

import type {IconType} from './Icon';

type TabInfo = {
  icon: IconType,
  id: string,
  label: string,
  title?: string,
};

export type Props = {
  currentTab: any,
  disabled?: boolean,
  id: string,
  selectTab: (tabID: any) => void,
  tabs: Array<TabInfo | null>,
  type: 'navigation' | 'profiler' | 'settings',
};

export default function TabBar({
  currentTab,
  disabled = false,
  id: groupName,
  selectTab,
  tabs,
  type,
}: Props): React.Node {
  if (!tabs.some(tab => tab !== null && tab.id === currentTab)) {
    const firstTab = ((tabs.find(tab => tab !== null): any): TabInfo);
    selectTab(firstTab.id);
  }

  const onChange = useCallback(
    ({currentTarget}: $FlowFixMe) => selectTab(currentTarget.value),
    [selectTab],
  );

  const handleKeyDown = useCallback((event: $FlowFixMe) => {
    switch (event.key) {
      case 'ArrowDown':
      case 'ArrowLeft':
      case 'ArrowRight':
      case 'ArrowUp':
        event.stopPropagation();
        break;
// ... (81 more lines)

Domain

Subdomains

Frequently Asked Questions

What does TabBar.js do?
TabBar.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in TabBar.js?
TabBar.js defines 2 function(s): TabBar, export.selectTab.
What does TabBar.js depend on?
TabBar.js imports 5 module(s): Icon, Icon.js, TabBar.css, react, tooltip.js.
What files import TabBar.js?
TabBar.js is imported by 3 file(s): DevTools.js, Profiler.js, SettingsModal.js.
Where is TabBar.js in the architecture?
TabBar.js is located at packages/react-devtools-shared/src/devtools/views/TabBar.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free