@fluentui/react-tabs 0.0.0-nightly50ae56ec3420220218.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.json +95 -0
  2. package/CHANGELOG.md +32 -0
  3. package/LICENSE +15 -0
  4. package/README.md +5 -0
  5. package/Spec.md +433 -0
  6. package/dist/react-tabs.d.ts +231 -0
  7. package/lib/Tab.d.ts +1 -0
  8. package/lib/Tab.js +2 -0
  9. package/lib/Tab.js.map +1 -0
  10. package/lib/TabList.d.ts +1 -0
  11. package/lib/TabList.js +2 -0
  12. package/lib/TabList.js.map +1 -0
  13. package/lib/components/Tab/Tab.d.ts +6 -0
  14. package/lib/components/Tab/Tab.js +15 -0
  15. package/lib/components/Tab/Tab.js.map +1 -0
  16. package/lib/components/Tab/Tab.types.d.ts +52 -0
  17. package/lib/components/Tab/Tab.types.js +2 -0
  18. package/lib/components/Tab/Tab.types.js.map +1 -0
  19. package/lib/components/Tab/index.d.ts +5 -0
  20. package/lib/components/Tab/index.js +6 -0
  21. package/lib/components/Tab/index.js.map +1 -0
  22. package/lib/components/Tab/renderTab.d.ts +5 -0
  23. package/lib/components/Tab/renderTab.js +18 -0
  24. package/lib/components/Tab/renderTab.js.map +1 -0
  25. package/lib/components/Tab/useTab.d.ts +12 -0
  26. package/lib/components/Tab/useTab.js +82 -0
  27. package/lib/components/Tab/useTab.js.map +1 -0
  28. package/lib/components/Tab/useTabStyles.d.ts +6 -0
  29. package/lib/components/Tab/useTabStyles.js +205 -0
  30. package/lib/components/Tab/useTabStyles.js.map +1 -0
  31. package/lib/components/TabList/TabList.d.ts +6 -0
  32. package/lib/components/TabList/TabList.js +17 -0
  33. package/lib/components/TabList/TabList.js.map +1 -0
  34. package/lib/components/TabList/TabList.types.d.ts +99 -0
  35. package/lib/components/TabList/TabList.types.js +2 -0
  36. package/lib/components/TabList/TabList.types.js.map +1 -0
  37. package/lib/components/TabList/TabListContext.d.ts +3 -0
  38. package/lib/components/TabList/TabListContext.js +17 -0
  39. package/lib/components/TabList/TabListContext.js.map +1 -0
  40. package/lib/components/TabList/index.d.ts +5 -0
  41. package/lib/components/TabList/index.js +6 -0
  42. package/lib/components/TabList/index.js.map +1 -0
  43. package/lib/components/TabList/renderTabList.d.ts +5 -0
  44. package/lib/components/TabList/renderTabList.js +19 -0
  45. package/lib/components/TabList/renderTabList.js.map +1 -0
  46. package/lib/components/TabList/useTabList.d.ts +12 -0
  47. package/lib/components/TabList/useTabList.js +106 -0
  48. package/lib/components/TabList/useTabList.js.map +1 -0
  49. package/lib/components/TabList/useTabListContextValues.d.ts +2 -0
  50. package/lib/components/TabList/useTabListContextValues.js +24 -0
  51. package/lib/components/TabList/useTabListContextValues.js.map +1 -0
  52. package/lib/components/TabList/useTabListStyles.d.ts +9 -0
  53. package/lib/components/TabList/useTabListStyles.js +118 -0
  54. package/lib/components/TabList/useTabListStyles.js.map +1 -0
  55. package/lib/index.d.ts +2 -0
  56. package/lib/index.js +3 -0
  57. package/lib/index.js.map +1 -0
  58. package/lib/tab.constants.d.ts +15 -0
  59. package/lib/tab.constants.js +17 -0
  60. package/lib/tab.constants.js.map +1 -0
  61. package/lib/tsdoc-metadata.json +11 -0
  62. package/lib-commonjs/Tab.d.ts +1 -0
  63. package/lib-commonjs/Tab.js +10 -0
  64. package/lib-commonjs/Tab.js.map +1 -0
  65. package/lib-commonjs/TabList.d.ts +1 -0
  66. package/lib-commonjs/TabList.js +10 -0
  67. package/lib-commonjs/TabList.js.map +1 -0
  68. package/lib-commonjs/components/Tab/Tab.d.ts +6 -0
  69. package/lib-commonjs/components/Tab/Tab.js +26 -0
  70. package/lib-commonjs/components/Tab/Tab.js.map +1 -0
  71. package/lib-commonjs/components/Tab/Tab.types.d.ts +52 -0
  72. package/lib-commonjs/components/Tab/Tab.types.js +6 -0
  73. package/lib-commonjs/components/Tab/Tab.types.js.map +1 -0
  74. package/lib-commonjs/components/Tab/index.d.ts +5 -0
  75. package/lib-commonjs/components/Tab/index.js +18 -0
  76. package/lib-commonjs/components/Tab/index.js.map +1 -0
  77. package/lib-commonjs/components/Tab/renderTab.d.ts +5 -0
  78. package/lib-commonjs/components/Tab/renderTab.js +29 -0
  79. package/lib-commonjs/components/Tab/renderTab.js.map +1 -0
  80. package/lib-commonjs/components/Tab/useTab.d.ts +12 -0
  81. package/lib-commonjs/components/Tab/useTab.js +95 -0
  82. package/lib-commonjs/components/Tab/useTab.js.map +1 -0
  83. package/lib-commonjs/components/Tab/useTabStyles.d.ts +6 -0
  84. package/lib-commonjs/components/Tab/useTabStyles.js +218 -0
  85. package/lib-commonjs/components/Tab/useTabStyles.js.map +1 -0
  86. package/lib-commonjs/components/TabList/TabList.d.ts +6 -0
  87. package/lib-commonjs/components/TabList/TabList.js +29 -0
  88. package/lib-commonjs/components/TabList/TabList.js.map +1 -0
  89. package/lib-commonjs/components/TabList/TabList.types.d.ts +99 -0
  90. package/lib-commonjs/components/TabList/TabList.types.js +6 -0
  91. package/lib-commonjs/components/TabList/TabList.types.js.map +1 -0
  92. package/lib-commonjs/components/TabList/TabListContext.d.ts +3 -0
  93. package/lib-commonjs/components/TabList/TabListContext.js +25 -0
  94. package/lib-commonjs/components/TabList/TabListContext.js.map +1 -0
  95. package/lib-commonjs/components/TabList/index.d.ts +5 -0
  96. package/lib-commonjs/components/TabList/index.js +18 -0
  97. package/lib-commonjs/components/TabList/index.js.map +1 -0
  98. package/lib-commonjs/components/TabList/renderTabList.d.ts +5 -0
  99. package/lib-commonjs/components/TabList/renderTabList.js +31 -0
  100. package/lib-commonjs/components/TabList/renderTabList.js.map +1 -0
  101. package/lib-commonjs/components/TabList/useTabList.d.ts +12 -0
  102. package/lib-commonjs/components/TabList/useTabList.js +118 -0
  103. package/lib-commonjs/components/TabList/useTabList.js.map +1 -0
  104. package/lib-commonjs/components/TabList/useTabListContextValues.d.ts +2 -0
  105. package/lib-commonjs/components/TabList/useTabListContextValues.js +33 -0
  106. package/lib-commonjs/components/TabList/useTabListContextValues.js.map +1 -0
  107. package/lib-commonjs/components/TabList/useTabListStyles.d.ts +9 -0
  108. package/lib-commonjs/components/TabList/useTabListStyles.js +131 -0
  109. package/lib-commonjs/components/TabList/useTabListStyles.js.map +1 -0
  110. package/lib-commonjs/index.d.ts +2 -0
  111. package/lib-commonjs/index.js +12 -0
  112. package/lib-commonjs/index.js.map +1 -0
  113. package/lib-commonjs/tab.constants.d.ts +15 -0
  114. package/lib-commonjs/tab.constants.js +23 -0
  115. package/lib-commonjs/tab.constants.js.map +1 -0
  116. package/package.json +64 -0
package/CHANGELOG.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "@fluentui/react-tabs",
3
+ "entries": [
4
+ {
5
+ "date": "Fri, 18 Feb 2022 04:14:56 GMT",
6
+ "tag": "@fluentui/react-tabs_v0.0.0-nightly50ae56ec3420220218.1",
7
+ "version": "0.0.0-nightly50ae56ec3420220218.1",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "email not defined",
12
+ "package": "@fluentui/react-tabs",
13
+ "commit": "0459873d472d7ad2a20c9bbb2facf6af8ef20995",
14
+ "comment": "Release nightly v9"
15
+ },
16
+ {
17
+ "author": "lingfangao@hotmail.com",
18
+ "package": "@fluentui/react-tabs",
19
+ "commit": "1aa9e691fcccd9a64168cea7941c0f1e71fa1d14",
20
+ "comment": "chore: Force bump all v9 packages to release correct source maps"
21
+ },
22
+ {
23
+ "author": "gcox@microsoft.com",
24
+ "package": "@fluentui/react-tabs",
25
+ "commit": "c9bd5b5a02ae94a8239ce1b56cac2f0d0dbd3586",
26
+ "comment": "Updated beta and RC components to ES2019"
27
+ },
28
+ {
29
+ "author": "gcox@microsoft.com",
30
+ "package": "@fluentui/react-tabs",
31
+ "commit": "7fcfaee82e4ed789e9e5b1516439563e2c4f165f",
32
+ "comment": "Publish initial version"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-tabs",
37
+ "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly50ae56ec3420220218.1",
38
+ "commit": "0459873d472d7ad2a20c9bbb2facf6af8ef20995"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-tabs",
43
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly50ae56ec3420220218.1",
44
+ "commit": "0459873d472d7ad2a20c9bbb2facf6af8ef20995"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-tabs",
49
+ "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly50ae56ec3420220218.1",
50
+ "commit": "0459873d472d7ad2a20c9bbb2facf6af8ef20995"
51
+ },
52
+ {
53
+ "author": "beachball",
54
+ "package": "@fluentui/react-tabs",
55
+ "comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly50ae56ec3420220218.1",
56
+ "commit": "0459873d472d7ad2a20c9bbb2facf6af8ef20995"
57
+ }
58
+ ]
59
+ }
60
+ },
61
+ {
62
+ "date": "Thu, 10 Feb 2022 08:52:26 GMT",
63
+ "tag": "@fluentui/react-tabs_v9.0.0-beta.4",
64
+ "version": "9.0.0-beta.4",
65
+ "comments": {
66
+ "prerelease": [
67
+ {
68
+ "author": "beachball",
69
+ "package": "@fluentui/react-tabs",
70
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.1",
71
+ "commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
72
+ },
73
+ {
74
+ "author": "beachball",
75
+ "package": "@fluentui/react-tabs",
76
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.1",
77
+ "commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
78
+ },
79
+ {
80
+ "author": "beachball",
81
+ "package": "@fluentui/react-tabs",
82
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.1",
83
+ "commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
84
+ },
85
+ {
86
+ "author": "beachball",
87
+ "package": "@fluentui/react-tabs",
88
+ "comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.1",
89
+ "commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
90
+ }
91
+ ]
92
+ }
93
+ }
94
+ ]
95
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,32 @@
1
+ # Change Log - @fluentui/react-tabs
2
+
3
+ This log was last generated on Fri, 18 Feb 2022 04:14:56 GMT and should not be manually modified.
4
+
5
+ <!-- Start content -->
6
+
7
+ ## [0.0.0-nightly50ae56ec3420220218.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabs_v0.0.0-nightly50ae56ec3420220218.1)
8
+
9
+ Fri, 18 Feb 2022 04:14:56 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabs_v9.0.0-beta.4..@fluentui/react-tabs_v0.0.0-nightly50ae56ec3420220218.1)
11
+
12
+ ### Changes
13
+
14
+ - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/0459873d472d7ad2a20c9bbb2facf6af8ef20995) by email not defined)
15
+ - chore: Force bump all v9 packages to release correct source maps ([PR #21690](https://github.com/microsoft/fluentui/pull/21690) by lingfangao@hotmail.com)
16
+ - Updated beta and RC components to ES2019 ([PR #20405](https://github.com/microsoft/fluentui/pull/20405) by gcox@microsoft.com)
17
+ - Publish initial version ([PR #21763](https://github.com/microsoft/fluentui/pull/21763) by gcox@microsoft.com)
18
+ - Bump @fluentui/react-tabster to v0.0.0-nightly50ae56ec3420220218.1 ([commit](https://github.com/microsoft/fluentui/commit/0459873d472d7ad2a20c9bbb2facf6af8ef20995) by beachball)
19
+ - Bump @fluentui/react-utilities to v0.0.0-nightly50ae56ec3420220218.1 ([commit](https://github.com/microsoft/fluentui/commit/0459873d472d7ad2a20c9bbb2facf6af8ef20995) by beachball)
20
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly50ae56ec3420220218.1 ([commit](https://github.com/microsoft/fluentui/commit/0459873d472d7ad2a20c9bbb2facf6af8ef20995) by beachball)
21
+ - Bump @fluentui/react-context-selector to v0.0.0-nightly50ae56ec3420220218.1 ([commit](https://github.com/microsoft/fluentui/commit/0459873d472d7ad2a20c9bbb2facf6af8ef20995) by beachball)
22
+
23
+ ## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabs_v9.0.0-beta.4)
24
+
25
+ Thu, 10 Feb 2022 08:52:26 GMT
26
+
27
+ ### Changes
28
+
29
+ - Bump @fluentui/react-tabster to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
30
+ - Bump @fluentui/react-utilities to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
31
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
32
+ - Bump @fluentui/react-context-selector to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ @fluentui/react-tabs
2
+
3
+ Copyright (c) Microsoft Corporation
4
+
5
+ All rights reserved.
6
+
7
+ MIT License
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+
15
+ Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @fluentui/react-tabs
2
+
3
+ **React Tabs components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**
4
+
5
+ These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
package/Spec.md ADDED
@@ -0,0 +1,433 @@
1
+ # @fluentui/react-tabs Spec
2
+
3
+ # Tabs
4
+
5
+ **GitHub Epic issue** - [Tabs/Pivot Convergence #20338](https://github.com/microsoft/fluentui/issues/20338)
6
+ **Figma** - [Tabs](https://www.figma.com/file/dK5AnDvvnSTWV9lduQWeDk/Tabs)
7
+
8
+ ## Background
9
+
10
+ Tabs allow for navigation between two or more content views and relies on text headers to
11
+ articulate the different sections of content.
12
+
13
+ There are a few different components typically provided for tabs:
14
+
15
+ - Tab or tab header. This is the individual tab the user clicks to display content. It most often has text, an icon, or both.
16
+ - Tab list or tab strip. This is a container for tabs and provides single selection behavior.
17
+ - Tab panel. This is a container for the content to display when an associated tab is selected.
18
+
19
+ In some cases the tab list and tab panels are provided together in a "tabs" aggregate component. This is historically done to provide the manilla folder tab style where the tab list and tab panels are arranged next to each other.
20
+
21
+ ## Prior Art - Open UI
22
+
23
+ Naming: The Open UI component naming matrix indicates Tabs is the most common and popular name for this component.
24
+ Only Fabric/Fluent UI v8 and earlier named it Pivot.
25
+
26
+ The [Tabs Research](https://open-ui.org/components/tabs.research) notes part naming and terminology are not
27
+ very consistent across libraries.
28
+
29
+ The API and implementations depend on how tabs are conceptualized and integrated with existing components.
30
+ For example, a set of tabs can be thought of as:
31
+
32
+ - a set styled buttons with radio selection behavior
33
+ - a menu list of menu items that toggle
34
+ - a command bar with radio buttons plus other commands and components
35
+ - a stack of components expected to render their state based on single/multi-select data.
36
+
37
+ Features common to most libraries:
38
+
39
+ - Grouping and consistent appearance across tabs within the same tab list
40
+ - Focus trap and keyboard commands for switching tabs
41
+ - Left/Right and Up/Down arrow keys when focus trapped
42
+ - Ctrl+Tab/Ctrl+Shift+Tab for cycling next/previous
43
+ - Text, an icon, or text with icon for tab content
44
+ - Horizontal or vertical layout
45
+ - LTR and RTL layout (i.e. ordering of tabs)
46
+ - Overflow or scrolling when tabs do not fit within available space
47
+
48
+ Features common to some libraries:
49
+
50
+ - Keyboard commands for individual tab focus navigation
51
+ - Tab/Shift+Tab to cycle focus through tabs
52
+ - Space bar to select currently focused tab
53
+ - Tab list containing both tabs and tab panels.
54
+ - Conditionally render or show/hide of tab panels based on current tab selection.
55
+
56
+ Advanced features supported by only a few libraries:
57
+
58
+ - Close/Hide individual tabs
59
+ - Tabs with drop-down content menus
60
+ - Reordering tabs, sometimes with drag-and-drop
61
+ - State indicators via badges
62
+ - Show or scroll to a specific tab (i.e. ensure visible and selected)
63
+
64
+ Given the ARIA standard roles of tablist and tab we can follow with TabList and Tab components.
65
+
66
+ ## Prior Art - Comparison with v0 and v8
67
+
68
+ The existing components are:
69
+
70
+ - v0 - [Menu](https://fluentsite.z22.web.core.windows.net/0.59.0/components/menu/definition)
71
+ - v8 - [Pivot](https://developer.microsoft.com/en-us/fluentui#/controls/web/pivot)
72
+
73
+ ### Approach
74
+
75
+ v0 Menu provides tabs, toolbars, menus, and breadcrumbs.
76
+ v0 Menu supports tabs interaction when accessibility={tabListBehavior}
77
+
78
+ v8 provides a separate Pivot component with tabs behavior and appearance customization.
79
+
80
+ ### Appearances
81
+
82
+ #### **Pivot**
83
+
84
+ A 'Pivot' appears as a horizontal set of borderless buttons with an underline indicating current selection.
85
+
86
+ v0 and v8 provide a 'Pivot' appearance.
87
+ v0: underlined=true
88
+ v8: by default
89
+
90
+ #### **Block Tab**
91
+
92
+ A 'Block Tab' appears as a horizontal set of borderless buttons.
93
+ The selection has an active color, rectangular background.
94
+
95
+ Both v0 and v8 provide the 'Block Tab' appearance.
96
+ v0: by default
97
+ v8: linkFormat="tabs"
98
+
99
+ #### **Variations**
100
+
101
+ v0 supports decorating tabs with arrows pointing toward the associated content.
102
+ v0: pointing=true
103
+
104
+ v8 supports a large tab style with increased padding per tab.
105
+ v8: linkSize="large"
106
+
107
+ ### Tab Item Content
108
+
109
+ Both v0 and v8 support text, icon, and text and icon as tab content.
110
+ v0 additionally supports menus as tab content.
111
+
112
+ Both v0 and v8 support custom rendering of tab content through a render props per item.
113
+
114
+ ### Tab Panel
115
+
116
+ v0 does not provide a tab panel since it is implemented through the menu component.
117
+ v8 supports the tab panel as the children of PivotItem. The tab content is provided through the header property.
118
+
119
+ ## Sample Code
120
+
121
+ ### Default
122
+
123
+ By default tabs are arranged horizontally.
124
+ Content within the tab is arranged horizontally.
125
+ It is centered (horizontally and vertically).
126
+ The default appearance is transparent.
127
+
128
+ ```tsx
129
+ <TabList>
130
+ <Tab value="tab1">One</Tab>
131
+ <Tab value="tab2">Two</Tab>
132
+ <Tab value="tab3">Three</Tab>
133
+ </TabList>
134
+ ```
135
+
136
+ ### Vertical
137
+
138
+ The vertical prop causes the tabs to be arranged vertically.
139
+ Content within the tab is still arranged horizontally and centered.
140
+
141
+ ```tsx
142
+ <TabList vertical>
143
+ <Tab value="tab1">One</Tab>
144
+ <Tab value="tab2">Two</Tab>
145
+ <Tab value="tab3">Three</Tab>
146
+ </TabList>
147
+ ```
148
+
149
+ ### Vertical Tab content
150
+
151
+ The verticalTabContent prop causes the content within the tab to be arranged vertically.
152
+ The content is still centered.
153
+ If the icon prop is set, the rendered icon is part of the vertical tab content.
154
+
155
+ ```tsx
156
+ <TabList verticalTabContent>
157
+ <Tab value="tab1">One</Tab>
158
+ <Tab value="tab2">Two</Tab>
159
+ <Tab value="tab3">Three</Tab>
160
+ </TabList>
161
+
162
+ <TabList vertical verticalTabContent>
163
+ <Tab value="tab1">One</Tab>
164
+ <Tab value="tab2">Two</Tab>
165
+ <Tab value="tab3">Three</Tab>
166
+ </TabList>
167
+ ```
168
+
169
+ ### Appearance
170
+
171
+ The default appearance is transparent.
172
+ Transparent has no border and background styles.
173
+ The selection indicator is a brand color line below the tab.
174
+ Hovering over a tab shows a gray line below the tab.
175
+
176
+ ```tsx
177
+ <TabList>
178
+ {/* ... */}
179
+ </TabList>
180
+
181
+ <TabList appearance="transparent">
182
+ {/* ... */}
183
+ </TabList>
184
+ ```
185
+
186
+ The subtle appearance is similar to transparent, but a light background is displayed when hovering over a tab.
187
+
188
+ ```tsx
189
+ <TabList appearance="subtle">{/* ... */}</TabList>
190
+ ```
191
+
192
+ ### Size
193
+
194
+ Small and medium sizes are supported.
195
+ The size affects the padding and spacing between elements.
196
+ Size can also affect the default icon (and badge) size.
197
+ The default size is medium.
198
+
199
+ ```tsx
200
+ <TabList size="small">
201
+ {/* ... */}
202
+ </TabList>
203
+
204
+ <TabList size="medium">
205
+ {/* ... */}
206
+ </TabList>
207
+ ```
208
+
209
+ ### With Icon
210
+
211
+ When the icon slot is filled, an icon is positioned before the tab content.
212
+
213
+ ```tsx
214
+ <TabList>
215
+ <Tab icon={<CheckboxComposite />} value="allowed">
216
+ Allowed
217
+ </Tab>
218
+ <Tab icon={<BlockedSite />} value="blocked">
219
+ Blocked
220
+ </Tab>
221
+ </TabList>
222
+ ```
223
+
224
+ An icon only tab is displayed when the icon slot is filled and tab content is omitted.
225
+
226
+ ```tsx
227
+ <TabList>
228
+ <Tab icon={<CheckboxComposite />} value="allowed" />
229
+ <Tab icon={<BlockedSite />} value="blocked" />
230
+ </TabList>
231
+ ```
232
+
233
+ ## API
234
+
235
+ ### Tab
236
+
237
+ TabCommons.value supports an arbitrary identifier value.
238
+ This is similar to Accordion's selection approach.
239
+
240
+ ```ts
241
+ export type TabValue = unknown;
242
+
243
+ export type TabCommons = {
244
+ disabled?: boolean;
245
+ disabledFocusable?: boolean;
246
+ value: TabValue;
247
+ };
248
+ ```
249
+
250
+ Each tab has an icon slot.
251
+
252
+ ```ts
253
+ export type TabSlots = {
254
+ root: IntrinsicSlotProps<'div'>;
255
+ icon?: IntrinsicSlotProps<'span'>;
256
+ };
257
+ ```
258
+
259
+ ```ts
260
+ export type TabProps = ComponentProps<TabSlots> & TabCommons;
261
+ ```
262
+
263
+ ### TabList
264
+
265
+ The tab list only has the root slot.
266
+
267
+ ```ts
268
+ export type TabListSlots = {
269
+ root: IntrinsicSlotProps<'div'>;
270
+ };
271
+ ```
272
+
273
+ The tab list supports tab selection events that include the value of the tab selected.
274
+
275
+ ```ts
276
+ export type TabSelectedEvent<E = HTMLElement> = React.MouseEvent<E> | React.KeyboardEvent<E>;
277
+
278
+ export type TabSelectedData = {
279
+ value: TabValue;
280
+ };
281
+
282
+ export type TabSelectedEventHandler = (event: TabSelectedEvent, data: TabSelectedData) => void;
283
+ ```
284
+
285
+ Tab list supports default and selected values for controlled and uncontrolled scenarios.
286
+
287
+ ```ts
288
+ export type TabListProps = ComponentProps<TabListSlots> & {
289
+ appearance?: 'transparent' | 'subtle';
290
+ defaultSelectedValue?: string | number;
291
+ selectedValue?: string | number;
292
+ size?: 'small' | 'medium';
293
+ vertical?: boolean;
294
+ verticalTabContent?: boolean;
295
+ onTabSelected?: TabSelectedEventHandler;
296
+ };
297
+ ```
298
+
299
+ The tab list communicates with tabs via context.
300
+ This applies appearance, size, and layout.
301
+ The tab can leverage the selectedValue and is expected to call selectTab when clicked.
302
+
303
+ By adding these properties to TabProps we could allow individual tabs to override these values.
304
+ However the expectation is that the tabs within a tab list have consistent layout and appearance.
305
+
306
+ ```ts
307
+ export type TabListContextValue = TabListCommons & {
308
+ appearance: 'transparent' | 'subtle';
309
+ selectedValue: string;
310
+ size: 'small' | 'medium';
311
+ selectTab: SelectTabEventHandler;
312
+ vertical: boolean;
313
+ };
314
+ ```
315
+
316
+ ## Structure
317
+
318
+ - _**Public**_
319
+
320
+ ```tsx
321
+ <TabList>
322
+ <Tab>One</Tab>
323
+ <Tab>Two</Tab>
324
+ <Tab>Three</Tab>
325
+ </TabList>
326
+ ```
327
+
328
+ - _**DOM**_
329
+
330
+ ```html
331
+ <div role="tablist">
332
+ <div role="tab">One</div>
333
+ <div role="tab">Two</div>
334
+ <div role="tab">Three</div>
335
+ </div>
336
+ ```
337
+
338
+ ## Migration
339
+
340
+ ### From v8
341
+
342
+ 1. Replace occurrences of `<Pivot>` with `<TabList>`
343
+ 2. Replace occurrences of `<PivotItem>` with `<Tab>`
344
+ 3. Replace `<PivotItem>` content with handling onTabSelected to show/hide associated content.
345
+ 4. Move PivotItem.headerText to be the content of Tab
346
+ 5. Subscribe to onTabSelected to show/hide content when a tab is selected.
347
+
348
+ ### From v0
349
+
350
+ 1. Replace use of `<Menu>` with `<TabList>`
351
+ 2. Replace items data with Tab instances, writing a `map` function as needed.
352
+
353
+ ## Behaviors
354
+
355
+ ### Selection
356
+
357
+ TabList provides single selection of a tab.
358
+
359
+ #### **Programmatic**
360
+
361
+ The TabList.selectedKey can control the currently selected tab.
362
+ The onTabSelected event informs callers of a selection change.
363
+ The event data includes the tab value.
364
+
365
+ #### **Mouse/Touch**
366
+
367
+ Clicking the tab selects it.
368
+
369
+ #### **Keyboard**
370
+
371
+ The tab list will support the prescribed [ARIA keyboard interaction](https://www.w3.org/TR/wai-aria-practices-1.1/#keyboard-interaction-19).
372
+
373
+ A Tablist allows focus of individual tabs.
374
+
375
+ When the TabList has focus, the user can use arrow keys to move focus to the next or previous tab.
376
+ The keys are based on layout. Horizontal uses left/right arrows and vertical uses up/down arrows.
377
+
378
+ When the TabList has focus, the user can use the home/end keys to move focus to the first/last tab.
379
+
380
+ A tab is selected when the spacebar/enter key is pressed for a focused tab.
381
+
382
+ The `TAB` key moves focus out of the tabs.
383
+
384
+ ## Accessibility
385
+
386
+ ARIA provides tab-specific roles:
387
+
388
+ - [tab](https://www.w3.org/TR/wai-aria-1.1/#tab): A grouping label providing a mechanism for selecting the tab content that is to be rendered to the user.
389
+ - [tablist](https://www.w3.org/TR/wai-aria-1.1/#tablist): A list of tab elements, which are references to tabpanel elements.
390
+ - [tabpanel](https://www.w3.org/TR/wai-aria-1.1/#tabpanel): A container for the resources associated with a tab, where each tab is contained in a tablist.
391
+
392
+ TabList and Tab will apply the `tablist` and `tab` ARIA roles.
393
+ The `tabpanel` will be reserved for possible future component.
394
+
395
+ ### Screen readers
396
+
397
+ Screen readers will read each tab's content.
398
+
399
+ # Future
400
+
401
+ ## Overflow Button/Dropdown
402
+
403
+ The design spec details a menu button (...) that displays the list of tabs that were not able to be displayed due to limited space. We have some concerns providing overflow as a default feature of tabs. The v1 of TabList and Tab will not include overflow.
404
+
405
+ - Overflow made the v0 toolbar difficult to maintain. Customers hacked around it when it did not meet app requirements.
406
+ - In v8, taking a dependency on menu over-complicated the button component and increased the default footprint. It also created a tighter binding with the overflow props matching the menu props and children.
407
+ - Overflow dropdown is one of many possible approaches such as scrolling, paging, multi-row, scroll-into-view. This may be best left as an application-level concern.
408
+ - The dropdown approach is called out by bootstrap as [problematic for usability and accessibility](https://react-bootstrap.github.io/components/tabs/#tabs-with-dropdown).
409
+ - Many (if not most) component libraries do not support dropdown overflow.
410
+ - There is not a general purpose overflow solution in vNext infrastructure. The team needs to explore options and formulate an approach.
411
+
412
+ ### Tab with Badge
413
+
414
+ The design spec shows a badge which is arranged near the icon or text. The initial vNext package will not provide a badge variant or badge slot.
415
+
416
+ - It is unclear if the badge is a common enough scenario to warrant the package dependency on react-badge.
417
+ - The positioning of the badge relative to other parts is not confirmed in the design spec
418
+ - Other controls may want to overlay a badge. We may want a general purpose badge overlay solution.
419
+ - The badge appears most often in an app bar scenario. It is unclear if the items with badges are really tabs, or some other kind of command button. We may have a future app bar/nav bar/toolbar component that handles the badge scenario.
420
+
421
+ > The intial work to explore supporting a badge used a BadgeTab variant.
422
+
423
+ ### TabPanel
424
+
425
+ While the design spec does not cover tab panels, v8 Pivot supports them through the content of the PivotItem. They are also a common scenario when the tabs are adjacent to the content associated with each tab.
426
+
427
+ - There are many approaches to handling tab panel content: show/hide, conditional render, navigation through a router
428
+ - We're not providing a manilla folder tab appearance, so there is no need for the tab panel to support styling for when the components are co-located. We may want to have a manilla folder appearance.
429
+
430
+ If/When we do support tab panels,
431
+
432
+ - we should provide flexible composition. The tabs should be able to be placed independent of the tab panels in the DOM. The caller should be able to wire the two together easily through event callbacks or state binding.
433
+ - we should make connecting tabs and tab panels easy by a Tabs container component that wires them together.