-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathTabList.doc.mjs
More file actions
154 lines (150 loc) · 8.75 KB
/
Copy pathTabList.doc.mjs
File metadata and controls
154 lines (150 loc) · 8.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// Copyright (c) Meta Platforms, Inc. and affiliates.
/** @type {import('@astryxdesign/cli/authoring').ComponentDoc} */
export const docs = {
name: 'TabList',
displayName: 'Tab List',
group: 'Tabs',
category: 'Navigation',
keywords: ["tabs","tabbar","tabstrip","navigation","tabpanel","tabgroup","segmented","navtabs","tab"],
playground: {
defaults: {
value: 'tab-1',
},
},
theming: {
targets: [
{className: 'astryx-tab-list', visualProps: ['size']},
{className: 'astryx-tab-strip'},
{className: 'astryx-tab-scroll-button'},
{className: 'astryx-tab', states: ['selected']},
{className: 'astryx-tab-indicator', states: ['selected']},
{className: 'astryx-tab-menu'},
{className: 'astryx-tab-menu-dropdown'},
{className: 'astryx-tab-menu-item'},
],
vars: [
{name: '--_tab-indicator-bottom', description: 'Vertical offset of the selected-tab indicator from the tab bottom edge. A host that draws its own bottom divider (Toolbar) sets this so the indicator sits on the divider instead of above it.', default: '-1px', private: true},
],
},
description: 'Nav wrapper that provides TabListContext (value, onChange, size) to Tab and TabMenu children.',
props: [
{
name: 'value',
type: 'string',
description: 'The currently selected tab value.',
required: true,
},
{
name: 'onChange',
type: '(value: string) => void',
description: 'Callback fired when a tab is selected.',
required: true,
},
{
name: 'size',
type: "'sm' | 'md' | 'lg'",
description: 'Size variant applied to all child tabs.',
default: "'md'",
},
{
name: 'layout',
type: "'hug' | 'fill'",
description: "Layout mode for tab sizing. 'hug': each tab hugs its content width. 'fill': tabs stretch equally to fill the container width.",
default: "'hug'",
},
{
name: 'hasDivider',
type: 'boolean',
description: 'Whether to show a bottom border divider under the tab list.',
default: 'false',
},
{
name: 'overflow',
type: "'auto' | 'scroll' | 'none'",
description: "What happens when the tabs are wider than the strip. 'auto' lets the component choose, which today always scrolls. 'scroll' scrolls the tabs horizontally, with edge fades and arrow affordances for pointers that can hover. 'none' turns overflow handling off and lets the tabs spill out of the strip. The selected tab is always scrolled back into view.",
default: "'auto'",
},
{
name: 'children',
type: 'ReactNode',
description: 'Tab and TabMenu items to render inside the nav.',
slotElements: [
{
__element: 'Tab',
props: {
label: 'Tab',
value: 'tab',
},
},
],
required: true,
},
{
name: 'xstyle',
type: 'StyleXStyles',
description: 'StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value: not an inline style object like style={{}}.',
},
],
components: [
{name: 'Tab'},
{name: 'TabMenu'},
],
usage: {
description:
'TabList provides tab-style navigation for organizing content into categorized sections. Use it to let users switch between related views without leaving the page, with overflow items handled by a built-in "more" menu.',
bestPractices: [
{ guidance: true, description: 'Keep tab labels short and descriptive so users can quickly scan available sections.' },
{ guidance: true, description: 'Leave overflow handling on: a strip narrower than its tabs scrolls, and the selected tab is kept in view. Use TabMenu when you want a curated group of extra options rather than a scrolling strip.' },
{ guidance: true, description: 'When using hasDivider with action buttons alongside tabs, match the Button size to the TabList size (both md, both sm); the divided tab strip reserves space so tabs and same-size buttons align to a shared baseline above the rail.' },
{ guidance: false, description: 'Use tabs for sequential steps or workflows; use a stepper or wizard pattern instead.' },
{ guidance: false, description: 'Place more than 6–8 visible tabs before the overflow menu; prioritize the most important categories.' },
{ guidance: false, description: 'Confuse TabList with SegmentedControl or ToggleButton. TabList is for navigation between views. SegmentedControl and ToggleButton are input controls: SegmentedControl always has exactly one selected option, while ToggleButton can be toggled on or off.' },
],
anatomy: [
{name: 'Left Content', required: false, description: 'Most important area; hugs content width.'},
{name: 'Center-Fill Content', required: false, description: 'Stretches to fill available space.'},
{name: 'Right Content', required: false, description: 'Hugs content width.'},
],
},
};
/** @type {import('@astryxdesign/cli/authoring').ComponentTranslationDoc} */
export const docsZh = {
usage: {
description:
'TabList provides tab-style navigation for organizing content into categorized sections. Use it to let users switch between related views without leaving the page, with overflow items handled by a built-in "more" menu.',
bestPractices: [
{ guidance: true, description: 'Keep tab labels short and descriptive so users can quickly scan available sections.' },
{ guidance: true, description: 'Leave overflow handling on: a strip narrower than its tabs scrolls, and the selected tab is kept in view. Use TabMenu when you want a curated group of extra options rather than a scrolling strip.' },
{ guidance: true, description: 'When using hasDivider with action buttons alongside tabs, match the Button size to the TabList size (both md, both sm); the divided tab strip reserves space so tabs and same-size buttons align to a shared baseline above the rail.' },
{ guidance: false, description: 'Use tabs for sequential steps or workflows; use a stepper or wizard pattern instead.' },
{ guidance: false, description: 'Place more than 6–8 visible tabs before the overflow menu; prioritize the most important categories.' },
{ guidance: false, description: 'Confuse TabList with SegmentedControl or ToggleButton. TabList is for navigation between views. SegmentedControl and ToggleButton are input controls: SegmentedControl always has exactly one selected option, while ToggleButton can be toggled on or off.' },
],
anatomy: [
{name: 'Left Content', required: false, description: 'Most important area; hugs content width.'},
{name: 'Center-Fill Content', required: false, description: 'Stretches to fill available space.'},
{name: 'Right Content', required: false, description: 'Hugs content width.'},
],
},
};
/** @type {import('@astryxdesign/cli/authoring').ComponentTranslationDoc} */
export const docsDense = {
description: 'Tab navigation w/ overflow menu support; semantic nav landmark w/ button or anchor tab items.',
usage: {
description:
'TabList provides tab-style navigation for organizing content into categorized sections. Use it to let users switch between related views without leaving the page, with overflow items handled by a built-in "more" menu.',
bestPractices: [
{ guidance: true, description: 'Keep tab labels short and descriptive so users can quickly scan available sections.' },
{ guidance: true, description: 'Leave overflow handling on: a strip narrower than its tabs scrolls, and the selected tab is kept in view. Use TabMenu when you want a curated group of extra options rather than a scrolling strip.' },
{ guidance: true, description: 'When using hasDivider with action buttons alongside tabs, match the Button size to the TabList size (both md, both sm); the divided tab strip reserves space so tabs and same-size buttons align to a shared baseline above the rail.' },
{ guidance: false, description: 'Use tabs for sequential steps or workflows; use a stepper or wizard pattern instead.' },
{ guidance: false, description: 'Place more than 6–8 visible tabs before the overflow menu; prioritize the most important categories.' },
{ guidance: false, description: 'Confuse TabList with SegmentedControl or ToggleButton. TabList is for navigation between views. SegmentedControl and ToggleButton are input controls: SegmentedControl always has exactly one selected option, while ToggleButton can be toggled on or off.' },
],
anatomy: [
{name: 'Left Content', required: false, description: 'Most important area; hugs content width.'},
{name: 'Center-Fill Content', required: false, description: 'Stretches to fill available space.'},
{name: 'Right Content', required: false, description: 'Hugs content width.'},
],
},
};