Outlook_Addin_LLM/node_modules/@fluentui/react-tabs
2024-11-29 21:36:41 +01:00
..
dist First version with simple frontend and Compose Email by AI 2024-11-29 21:36:41 +01:00
lib First version with simple frontend and Compose Email by AI 2024-11-29 21:36:41 +01:00
lib-commonjs First version with simple frontend and Compose Email by AI 2024-11-29 21:36:41 +01:00
CHANGELOG.md First version with simple frontend and Compose Email by AI 2024-11-29 21:36:41 +01:00
LICENSE First version with simple frontend and Compose Email by AI 2024-11-29 21:36:41 +01:00
package.json First version with simple frontend and Compose Email by AI 2024-11-29 21:36:41 +01:00
README.md First version with simple frontend and Compose Email by AI 2024-11-29 21:36:41 +01:00

@fluentui/react-tabs

Tabs components for Fluent UI React

  • A TabList provides single selection from a list of tabs.
  • When a Tab is selected, the content associated with the selected tab is displayed and other content is hidden.
  • A TabList has options to control how tabs are displayed:
    • horizontal or vertical
    • transparent or subtle appearance
    • small or medium size tabs
  • Each Tab typically contains a text header and often includes an icon.

Usage

To import Tabs:

import { Tablist, Tab } from '@fluentui/react-components';

Examples

To display tabs, declare a TabList with a list of Tab components as children.

Text is typically used within each tab, but you can place any content you like. You can add an icon to a tab through the icon property.

Each Tab requires a unique value. The value is passed as part of the data parameter when a tab is clicked and the onTabSelect event is raised. The selectedValue property allows you to control the selected tab.

import { SelectTabData, SelectTabEvent, TabList, Tab } from '@fluentui/react-components';
import { CalendarMonthRegular } from '@fluentui/react-icons';

export const TabExample = () => {
  const [selectedValue, setSelectedValue] = React.useState<TabValue>('conditions');

  const onTabSelect = (event: SelectTabEvent, data: SelectTabData) => {
    console.log(`The ${data.value} tab was selected`);
    setSelectedValue(data.value);
  };

  return (
    <TabList selectedValue={selectedValue} onTabSelect={onTabSelect}>
      <Tab value="tab1">First Tab</Tab>
      <Tab value="tab2" icon={<CalendarMonthRegular />}>
        Second Tab
      </Tab>
      <Tab value="tab3">Third Tab</Tab>
      <Tab value="tab4">Fourth Tab</Tab>
    </TabList>
  );
};

See Fluent UI Storybook for more detailed usage examples.

Alternatively, run Storybook locally with:

  1. yarn start
  2. Select react-tabs from the list.

Specification

See SPEC.md.

Migration Guide

If you're upgrading to Fluent UI v9 see MIGRATION.md for guidance on updating to the latest Link implementation.