@patternfly/react-core 5.0.0-alpha.85 → 5.0.0-alpha.87
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.
- package/CHANGELOG.md +14 -0
- package/dist/esm/components/AboutModal/package.json +1 -1
- package/dist/esm/components/Accordion/package.json +1 -1
- package/dist/esm/components/ActionList/package.json +1 -1
- package/dist/esm/components/Alert/package.json +1 -1
- package/dist/esm/components/Avatar/package.json +1 -1
- package/dist/esm/components/BackToTop/package.json +1 -1
- package/dist/esm/components/Backdrop/package.json +1 -1
- package/dist/esm/components/BackgroundImage/package.json +1 -1
- package/dist/esm/components/Badge/package.json +1 -1
- package/dist/esm/components/Banner/package.json +1 -1
- package/dist/esm/components/Brand/package.json +1 -1
- package/dist/esm/components/Breadcrumb/package.json +1 -1
- package/dist/esm/components/Button/package.json +1 -1
- package/dist/esm/components/CalendarMonth/package.json +1 -1
- package/dist/esm/components/Card/package.json +1 -1
- package/dist/esm/components/Checkbox/package.json +1 -1
- package/dist/esm/components/Chip/package.json +1 -1
- package/dist/esm/components/ClipboardCopy/package.json +1 -1
- package/dist/esm/components/CodeBlock/package.json +1 -1
- package/dist/esm/components/DataList/package.json +1 -1
- package/dist/esm/components/DatePicker/package.json +1 -1
- package/dist/esm/components/DescriptionList/package.json +1 -1
- package/dist/esm/components/Divider/package.json +1 -1
- package/dist/esm/components/DragDrop/package.json +1 -1
- package/dist/esm/components/Drawer/package.json +1 -1
- package/dist/esm/components/Dropdown/package.json +1 -1
- package/dist/esm/components/DualListSelector/package.json +1 -1
- package/dist/esm/components/EmptyState/package.json +1 -1
- package/dist/esm/components/ExpandableSection/package.json +1 -1
- package/dist/esm/components/FileUpload/package.json +1 -1
- package/dist/esm/components/Form/package.json +1 -1
- package/dist/esm/components/FormSelect/package.json +1 -1
- package/dist/esm/components/HelperText/package.json +1 -1
- package/dist/esm/components/Hint/package.json +1 -1
- package/dist/esm/components/Icon/package.json +1 -1
- package/dist/esm/components/InputGroup/package.json +1 -1
- package/dist/esm/components/JumpLinks/package.json +1 -1
- package/dist/esm/components/Label/package.json +1 -1
- package/dist/esm/components/LabelGroup/package.json +1 -1
- package/dist/esm/components/List/package.json +1 -1
- package/dist/esm/components/LoginPage/package.json +1 -1
- package/dist/esm/components/Masthead/package.json +1 -1
- package/dist/esm/components/Menu/package.json +1 -1
- package/dist/esm/components/MenuToggle/package.json +1 -1
- package/dist/esm/components/Modal/package.json +1 -1
- package/dist/esm/components/MultipleFileUpload/MultipleFileUpload.d.ts +2 -2
- package/dist/esm/components/MultipleFileUpload/MultipleFileUpload.d.ts.map +1 -1
- package/dist/esm/components/MultipleFileUpload/MultipleFileUpload.js +2 -2
- package/dist/esm/components/MultipleFileUpload/MultipleFileUpload.js.map +1 -1
- package/dist/esm/components/MultipleFileUpload/package.json +1 -1
- package/dist/esm/components/Nav/package.json +1 -1
- package/dist/esm/components/NotificationBadge/package.json +1 -1
- package/dist/esm/components/NotificationDrawer/package.json +1 -1
- package/dist/esm/components/NumberInput/package.json +1 -1
- package/dist/esm/components/OverflowMenu/package.json +1 -1
- package/dist/esm/components/Page/package.json +1 -1
- package/dist/esm/components/Pagination/package.json +1 -1
- package/dist/esm/components/Panel/package.json +1 -1
- package/dist/esm/components/Popover/package.json +1 -1
- package/dist/esm/components/Progress/package.json +1 -1
- package/dist/esm/components/ProgressStepper/package.json +1 -1
- package/dist/esm/components/Radio/package.json +1 -1
- package/dist/esm/components/SearchInput/package.json +1 -1
- package/dist/esm/components/Select/package.json +1 -1
- package/dist/esm/components/Sidebar/package.json +1 -1
- package/dist/esm/components/SimpleList/package.json +1 -1
- package/dist/esm/components/Skeleton/package.json +1 -1
- package/dist/esm/components/SkipToContent/package.json +1 -1
- package/dist/esm/components/Slider/Slider.d.ts +2 -1
- package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
- package/dist/esm/components/Slider/Slider.js +7 -7
- package/dist/esm/components/Slider/Slider.js.map +1 -1
- package/dist/esm/components/Slider/package.json +1 -1
- package/dist/esm/components/Spinner/package.json +1 -1
- package/dist/esm/components/Switch/package.json +1 -1
- package/dist/esm/components/Tabs/package.json +1 -1
- package/dist/esm/components/Text/package.json +1 -1
- package/dist/esm/components/TextArea/package.json +1 -1
- package/dist/esm/components/TextInput/package.json +1 -1
- package/dist/esm/components/TextInputGroup/package.json +1 -1
- package/dist/esm/components/Tile/package.json +1 -1
- package/dist/esm/components/TimePicker/package.json +1 -1
- package/dist/esm/components/Timestamp/package.json +1 -1
- package/dist/esm/components/Title/package.json +1 -1
- package/dist/esm/components/ToggleGroup/package.json +1 -1
- package/dist/esm/components/Toolbar/package.json +1 -1
- package/dist/esm/components/Tooltip/package.json +1 -1
- package/dist/esm/components/TreeView/package.json +1 -1
- package/dist/esm/components/Truncate/package.json +1 -1
- package/dist/esm/components/Wizard/hooks/package.json +1 -1
- package/dist/esm/components/Wizard/package.json +1 -1
- package/dist/esm/components/package.json +1 -1
- package/dist/esm/deprecated/components/ApplicationLauncher/package.json +1 -1
- package/dist/esm/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/esm/deprecated/components/Dropdown/package.json +1 -1
- package/dist/esm/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/esm/deprecated/components/PageHeader/package.json +1 -1
- package/dist/esm/deprecated/components/Select/package.json +1 -1
- package/dist/esm/deprecated/components/Wizard/package.json +1 -1
- package/dist/esm/deprecated/components/package.json +1 -1
- package/dist/esm/deprecated/package.json +1 -1
- package/dist/esm/helpers/Popper/thirdparty/popper-core/package.json +1 -1
- package/dist/esm/helpers/package.json +1 -1
- package/dist/esm/layouts/Bullseye/package.json +1 -1
- package/dist/esm/layouts/Flex/package.json +1 -1
- package/dist/esm/layouts/Gallery/package.json +1 -1
- package/dist/esm/layouts/Grid/package.json +1 -1
- package/dist/esm/layouts/Level/package.json +1 -1
- package/dist/esm/layouts/Split/package.json +1 -1
- package/dist/esm/layouts/Stack/package.json +1 -1
- package/dist/esm/layouts/package.json +1 -1
- package/dist/esm/next/components/package.json +1 -1
- package/dist/esm/next/package.json +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/js/components/AboutModal/package.json +1 -1
- package/dist/js/components/Accordion/package.json +1 -1
- package/dist/js/components/ActionList/package.json +1 -1
- package/dist/js/components/Alert/package.json +1 -1
- package/dist/js/components/Avatar/package.json +1 -1
- package/dist/js/components/BackToTop/package.json +1 -1
- package/dist/js/components/Backdrop/package.json +1 -1
- package/dist/js/components/BackgroundImage/package.json +1 -1
- package/dist/js/components/Badge/package.json +1 -1
- package/dist/js/components/Banner/package.json +1 -1
- package/dist/js/components/Brand/package.json +1 -1
- package/dist/js/components/Breadcrumb/package.json +1 -1
- package/dist/js/components/Button/package.json +1 -1
- package/dist/js/components/CalendarMonth/package.json +1 -1
- package/dist/js/components/Card/package.json +1 -1
- package/dist/js/components/Checkbox/package.json +1 -1
- package/dist/js/components/Chip/package.json +1 -1
- package/dist/js/components/ClipboardCopy/package.json +1 -1
- package/dist/js/components/CodeBlock/package.json +1 -1
- package/dist/js/components/DataList/package.json +1 -1
- package/dist/js/components/DatePicker/package.json +1 -1
- package/dist/js/components/DescriptionList/package.json +1 -1
- package/dist/js/components/Divider/package.json +1 -1
- package/dist/js/components/DragDrop/package.json +1 -1
- package/dist/js/components/Drawer/package.json +1 -1
- package/dist/js/components/Dropdown/package.json +1 -1
- package/dist/js/components/DualListSelector/package.json +1 -1
- package/dist/js/components/EmptyState/package.json +1 -1
- package/dist/js/components/ExpandableSection/package.json +1 -1
- package/dist/js/components/FileUpload/package.json +1 -1
- package/dist/js/components/Form/package.json +1 -1
- package/dist/js/components/FormSelect/package.json +1 -1
- package/dist/js/components/HelperText/package.json +1 -1
- package/dist/js/components/Hint/package.json +1 -1
- package/dist/js/components/Icon/package.json +1 -1
- package/dist/js/components/InputGroup/package.json +1 -1
- package/dist/js/components/JumpLinks/package.json +1 -1
- package/dist/js/components/Label/package.json +1 -1
- package/dist/js/components/LabelGroup/package.json +1 -1
- package/dist/js/components/List/package.json +1 -1
- package/dist/js/components/LoginPage/package.json +1 -1
- package/dist/js/components/Masthead/package.json +1 -1
- package/dist/js/components/Menu/package.json +1 -1
- package/dist/js/components/MenuToggle/package.json +1 -1
- package/dist/js/components/Modal/package.json +1 -1
- package/dist/js/components/MultipleFileUpload/MultipleFileUpload.d.ts +2 -2
- package/dist/js/components/MultipleFileUpload/MultipleFileUpload.d.ts.map +1 -1
- package/dist/js/components/MultipleFileUpload/MultipleFileUpload.js +2 -2
- package/dist/js/components/MultipleFileUpload/MultipleFileUpload.js.map +1 -1
- package/dist/js/components/MultipleFileUpload/package.json +1 -1
- package/dist/js/components/Nav/package.json +1 -1
- package/dist/js/components/NotificationBadge/package.json +1 -1
- package/dist/js/components/NotificationDrawer/package.json +1 -1
- package/dist/js/components/NumberInput/package.json +1 -1
- package/dist/js/components/OverflowMenu/package.json +1 -1
- package/dist/js/components/Page/package.json +1 -1
- package/dist/js/components/Pagination/package.json +1 -1
- package/dist/js/components/Panel/package.json +1 -1
- package/dist/js/components/Popover/package.json +1 -1
- package/dist/js/components/Progress/package.json +1 -1
- package/dist/js/components/ProgressStepper/package.json +1 -1
- package/dist/js/components/Radio/package.json +1 -1
- package/dist/js/components/SearchInput/package.json +1 -1
- package/dist/js/components/Select/package.json +1 -1
- package/dist/js/components/Sidebar/package.json +1 -1
- package/dist/js/components/SimpleList/package.json +1 -1
- package/dist/js/components/Skeleton/package.json +1 -1
- package/dist/js/components/SkipToContent/package.json +1 -1
- package/dist/js/components/Slider/Slider.d.ts +2 -1
- package/dist/js/components/Slider/Slider.d.ts.map +1 -1
- package/dist/js/components/Slider/Slider.js +7 -7
- package/dist/js/components/Slider/Slider.js.map +1 -1
- package/dist/js/components/Slider/package.json +1 -1
- package/dist/js/components/Spinner/package.json +1 -1
- package/dist/js/components/Switch/package.json +1 -1
- package/dist/js/components/Tabs/package.json +1 -1
- package/dist/js/components/Text/package.json +1 -1
- package/dist/js/components/TextArea/package.json +1 -1
- package/dist/js/components/TextInput/package.json +1 -1
- package/dist/js/components/TextInputGroup/package.json +1 -1
- package/dist/js/components/Tile/package.json +1 -1
- package/dist/js/components/TimePicker/package.json +1 -1
- package/dist/js/components/Timestamp/package.json +1 -1
- package/dist/js/components/Title/package.json +1 -1
- package/dist/js/components/ToggleGroup/package.json +1 -1
- package/dist/js/components/Toolbar/package.json +1 -1
- package/dist/js/components/Tooltip/package.json +1 -1
- package/dist/js/components/TreeView/package.json +1 -1
- package/dist/js/components/Truncate/package.json +1 -1
- package/dist/js/components/Wizard/hooks/package.json +1 -1
- package/dist/js/components/Wizard/package.json +1 -1
- package/dist/js/components/package.json +1 -1
- package/dist/js/deprecated/components/ApplicationLauncher/package.json +1 -1
- package/dist/js/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/js/deprecated/components/Dropdown/package.json +1 -1
- package/dist/js/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/js/deprecated/components/PageHeader/package.json +1 -1
- package/dist/js/deprecated/components/Select/package.json +1 -1
- package/dist/js/deprecated/components/Wizard/package.json +1 -1
- package/dist/js/deprecated/components/package.json +1 -1
- package/dist/js/deprecated/package.json +1 -1
- package/dist/js/helpers/Popper/thirdparty/popper-core/package.json +1 -1
- package/dist/js/helpers/package.json +1 -1
- package/dist/js/layouts/Bullseye/package.json +1 -1
- package/dist/js/layouts/Flex/package.json +1 -1
- package/dist/js/layouts/Gallery/package.json +1 -1
- package/dist/js/layouts/Grid/package.json +1 -1
- package/dist/js/layouts/Level/package.json +1 -1
- package/dist/js/layouts/Split/package.json +1 -1
- package/dist/js/layouts/Stack/package.json +1 -1
- package/dist/js/layouts/package.json +1 -1
- package/dist/js/next/components/package.json +1 -1
- package/dist/js/next/package.json +1 -1
- package/dist/js/package.json +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/MultipleFileUpload/MultipleFileUpload.tsx +3 -3
- package/src/components/MultipleFileUpload/examples/MultipleFileUpload.md +14 -0
- package/src/components/MultipleFileUpload/examples/MultipleFileUploadBasic.tsx +2 -1
- package/src/components/OverflowMenu/examples/OverflowMenuBreakpointOnContainer.tsx +2 -1
- package/src/components/Slider/Slider.tsx +15 -7
- package/src/components/Slider/examples/Slider.md +26 -0
- package/src/components/Slider/examples/SliderActions.tsx +3 -2
- package/src/components/Slider/examples/SliderContinuous.tsx +8 -4
- package/src/components/Slider/examples/SliderDisabled.tsx +8 -3
- package/src/components/Slider/examples/SliderDiscrete.tsx +8 -8
- package/src/components/Slider/examples/SliderThumbValueInput.tsx +2 -1
- package/src/components/Slider/examples/SliderValueInput.tsx +8 -5
- package/src/components/Tabs/examples/Tabs.md +120 -44
- package/src/components/Toolbar/examples/Toolbar.md +41 -19
- package/src/components/Toolbar/examples/ToolbarItems.tsx +1 -1
- package/src/demos/examples/MultipleFileUpload/MultipleFileUploadRejectedFile.tsx +13 -12
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: Tabs
|
|
3
3
|
section: components
|
|
4
4
|
cssPrefix: pf-c-tabs
|
|
5
|
-
propComponents: ['Tabs', 'Tab',
|
|
5
|
+
propComponents: ['Tabs', 'Tab', 'TabContent', 'TabTitleText', 'TabTitleIcon', 'horizontalOverflowObject', 'TabAction']
|
|
6
6
|
ouia: true
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -15,141 +15,217 @@ import ProjectDiagramIcon from '@patternfly/react-icons/dist/esm/icons/project-d
|
|
|
15
15
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
16
16
|
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
17
17
|
|
|
18
|
-
Most tab variations are available as open (default) or box style tabs. Select the 'isBox' checkbox to preview an example with box styled tabs.
|
|
19
|
-
The Tabs items background can be also toggled with 'Tab light variation' checkbox.
|
|
20
|
-
Similarly the 'Tab content light variation' checkbox affects the TabContent background.
|
|
21
|
-
|
|
22
18
|
## Examples
|
|
23
19
|
|
|
24
|
-
### Default
|
|
20
|
+
### Default tabs
|
|
21
|
+
|
|
22
|
+
A `<Tabs>` component contains multiple `<Tab>` components that may be used to navigate between sets of content within a page.
|
|
23
|
+
|
|
24
|
+
You can adjust a tab in the following ways:
|
|
25
|
+
|
|
26
|
+
- To label a tab with text, pass a `<TabTitleText>` component into the `title` property of a `<Tab>`.
|
|
27
|
+
- To disable a tab, use the `isDisabled` property. Tabs using `isDisabled` are not perceivable or operable by users navigating via assistive technologies.
|
|
28
|
+
- To disable a tab, but keep it perceivable to assistive technology users, use the `isAriaDisabled` property. If a disabled tab has a tooltip, use this property instead of `isDisabled`.
|
|
29
|
+
- To add a tooltip to an aria-disabled tab, use the `tooltip` property.
|
|
25
30
|
|
|
26
|
-
|
|
31
|
+
Most tab variations can either be 'default' or 'boxed':
|
|
32
|
+
|
|
33
|
+
- Default tabs do not have any borders and use a bottom line to distinguish between a selected tab, a hovered tab, and an inactive tab.
|
|
34
|
+
- Boxed tabs are outlined to emphasize the area that a tab spans. To preview boxed tabs in the following examples, select the 'isBox' checkbox, which sets the `isBox` property to true.
|
|
27
35
|
|
|
28
36
|
```ts file="./TabsDefault.tsx"
|
|
29
37
|
```
|
|
30
38
|
|
|
31
|
-
###
|
|
39
|
+
### Boxed light tabs
|
|
32
40
|
|
|
33
|
-
|
|
41
|
+
To change the background color of boxed tabs, use the `variant` property.
|
|
34
42
|
|
|
35
|
-
The
|
|
43
|
+
The following example passes `variant={isTabsLightScheme ? 'light300' : 'default'}` into the `<Tabs>` component to style the tabs with a lighter color.
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
Toggle the tab color by selecting the 'Tabs light variation' checkbox in the following example.
|
|
46
|
+
|
|
47
|
+
```ts file="./TabsBoxLight.tsx"
|
|
38
48
|
```
|
|
39
49
|
|
|
40
|
-
###
|
|
50
|
+
### Vertical tabs
|
|
41
51
|
|
|
42
|
-
|
|
52
|
+
Vertical tabs are placed on the left-hand side of a page or container and may appear in both 'default' and 'boxed' tab variations.
|
|
53
|
+
|
|
54
|
+
To style tabs vertically, use the `isVertical` property.
|
|
55
|
+
|
|
56
|
+
```ts file="./TabsVertical.tsx"
|
|
43
57
|
```
|
|
44
58
|
|
|
45
|
-
###
|
|
59
|
+
### Vertical expandable tabs
|
|
46
60
|
|
|
47
|
-
|
|
61
|
+
Vertical tabs can be made expandable to save space. Users can select the caret to expand a menu and switch between tabs.
|
|
62
|
+
|
|
63
|
+
Expandable tabs can be enabled at different breakpoints. The following example passes `expandable={{ default: 'expandable', md: 'nonExpandable', lg: 'expandable' }}` into the `<Tabs>` component.
|
|
64
|
+
|
|
65
|
+
To flag vertical tabs when they're expanded, use the `isExpanded` property.
|
|
66
|
+
|
|
67
|
+
```ts file="./TabsVerticalExpandable.tsx"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Vertical expandable uncontrolled
|
|
71
|
+
|
|
72
|
+
To flag the default expanded state for uncontrolled tabs, use the `defaultIsExpanded` property.
|
|
73
|
+
|
|
74
|
+
```ts file="./TabsVerticalExpandableUncontrolled.tsx"
|
|
48
75
|
```
|
|
49
76
|
|
|
50
|
-
### Default overflow
|
|
77
|
+
### Default overflow tabs
|
|
78
|
+
|
|
79
|
+
By default, overflow is applied when there are too many tabs for the width of the container they are in. This overflow can be navigated by side-scrolling within the tabs section, or by selecting the left and right arrows.
|
|
51
80
|
|
|
52
81
|
```ts file="./TabsDefaultOverflow.tsx"
|
|
53
82
|
```
|
|
54
83
|
|
|
55
|
-
### Horizontal overflow
|
|
84
|
+
### Horizontal overflow tabs
|
|
85
|
+
|
|
86
|
+
Horizontal overflow can be used instead of the default application. To navigate horizontal overflow tabs users can select the last tab, labeled “more”, to see the overflowed content.
|
|
87
|
+
|
|
88
|
+
To enable horizontal overflow, use the `isOverflowHorizontal` property.
|
|
89
|
+
|
|
90
|
+
In the following example, select the 'Show overflowing tab count' checkbox to add a count of overflow items to the final “more” tab.
|
|
56
91
|
|
|
57
92
|
```ts file="./TabsHorizontalOverflow.tsx" isBeta
|
|
58
93
|
```
|
|
59
94
|
|
|
60
|
-
###
|
|
95
|
+
### With tooltip react ref
|
|
61
96
|
|
|
62
|
-
|
|
63
|
-
```
|
|
97
|
+
When using a React ref to link a tooltip to a tab component via the `reference` property, you should avoid manually passing in a value of "off" to the `aria-live` property. Doing so may cause the tooltip to become less accessible to assistive technologies.
|
|
64
98
|
|
|
65
|
-
|
|
99
|
+
The tooltip should also have the `id` property passed in. The value of `id` should be passed into the tab's `aria-describedby` property. This ensures a tooltip used with a React ref will be announced by the JAWS and NVDA screen readers.
|
|
66
100
|
|
|
67
|
-
```ts file="./
|
|
101
|
+
```ts file="./TabsTooltipReactRef.tsx"
|
|
68
102
|
```
|
|
69
103
|
|
|
70
|
-
###
|
|
104
|
+
### Uncontrolled tabs
|
|
71
105
|
|
|
72
|
-
|
|
106
|
+
To allow the `<Tabs>` component to manage setting the active tab and displaying correct content itself, use uncontrolled tabs, as shown in the following example.
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
```ts file="./TabsUncontrolled.tsx"
|
|
73
110
|
```
|
|
74
111
|
|
|
75
|
-
###
|
|
112
|
+
### With adjusted inset
|
|
113
|
+
|
|
114
|
+
To adjust the inset of tabs and visually separate them more, use the `inset` property. You can set the inset to "insetNone", "insetSm", "insetMd", "insetLg", "insetXl", or "inset2xl" at "default", "sm", "md", "lg, "xl, and "2xl" breakpoints.
|
|
76
115
|
|
|
77
116
|
```ts file="./TabsInset.tsx"
|
|
78
117
|
```
|
|
79
118
|
|
|
80
|
-
###
|
|
119
|
+
### With page insets
|
|
120
|
+
|
|
121
|
+
To adjust the left padding of tabs, use the `usePageInsets` property. This property aligns the tabs padding with the default padding of the page section, which makes it easier to align tabs with page section content.
|
|
81
122
|
|
|
82
123
|
```ts file="./TabsPageInsets.tsx"
|
|
83
124
|
```
|
|
84
125
|
|
|
85
|
-
###
|
|
126
|
+
### With icons and text
|
|
127
|
+
|
|
128
|
+
You can render different content in the `title` property of a tab to add icons and text.
|
|
129
|
+
|
|
130
|
+
To add an icon to a tab, pass a `<TabTitleIcon>` component that contains the icon of your choice into the `title`. To use an icon alongside styled text, keep the text in the `<TabTitleText>` component.
|
|
86
131
|
|
|
87
132
|
```ts file="./TabsIconAndText.tsx"
|
|
88
133
|
```
|
|
89
134
|
|
|
90
|
-
###
|
|
135
|
+
### Secondary tabs
|
|
91
136
|
|
|
92
|
-
|
|
93
|
-
```
|
|
137
|
+
Use secondary tabs as "sub tabs" or within other components, like modals. Secondary tabs have less visually prominent styling.
|
|
94
138
|
|
|
95
|
-
|
|
139
|
+
To apply secondary styling to tabs, use the `isSecondary` property.
|
|
96
140
|
|
|
97
|
-
```ts file="
|
|
141
|
+
```ts file="./TabsSubtabs.tsx"
|
|
98
142
|
```
|
|
99
143
|
|
|
100
|
-
### Filled with icons
|
|
144
|
+
### Filled tabs with icons
|
|
145
|
+
|
|
146
|
+
To allow tabs to fill the available width of the page section, use the `isFilled` property.
|
|
101
147
|
|
|
102
148
|
```ts file="./TabsFilledWithIcons.tsx"
|
|
103
149
|
```
|
|
104
150
|
|
|
105
|
-
###
|
|
151
|
+
### Tabs linked to nav elements
|
|
152
|
+
|
|
153
|
+
To let tabs link to nav elements, pass `{TabsComponent.nav}` into the `component` property.
|
|
154
|
+
|
|
155
|
+
Nav tabs should use the `href` property to link the tab to the URL of another page or page section. A tab with an `href` will render as an `<a>` instead of a `<button>`.
|
|
106
156
|
|
|
107
157
|
```ts file="./TabsNav.tsx"
|
|
108
158
|
```
|
|
109
159
|
|
|
110
|
-
###
|
|
160
|
+
### Secondary tabs linked to nav elements
|
|
161
|
+
|
|
162
|
+
Secondary tabs can also link to nav elements.
|
|
111
163
|
|
|
112
164
|
```ts file="./TabsNavSecondary.tsx"
|
|
113
165
|
```
|
|
114
166
|
|
|
115
|
-
###
|
|
167
|
+
### With separate content
|
|
168
|
+
|
|
169
|
+
If a `<TabContent>` component is defined outside of a `<Tabs>` component, use the `tabContentRef` and `tabContentId` properties
|
|
116
170
|
|
|
117
171
|
```ts file="./TabsSeparateContent.tsx"
|
|
118
172
|
```
|
|
119
173
|
|
|
120
|
-
###
|
|
174
|
+
### With tab content with body and padding
|
|
175
|
+
|
|
176
|
+
To add a content body to a `<TabContent>` component, pass a `<TabContentBody>`. To add padding to the body section, use the `hasPadding` property.
|
|
121
177
|
|
|
122
178
|
```ts file="./TabsContentWithBodyPadding.tsx"
|
|
123
179
|
```
|
|
124
180
|
|
|
125
181
|
### Children mounting on click
|
|
126
182
|
|
|
183
|
+
To mount tab children (add to the DOM) when a tab is clicked, use the `mountOnEnter` property.
|
|
184
|
+
|
|
185
|
+
Note that this property does not create the tab children until the tab is clicked, so they are not preloaded into the DOM.
|
|
186
|
+
|
|
127
187
|
```ts file="./TabsChildrenMounting.tsx"
|
|
128
188
|
```
|
|
129
189
|
|
|
130
190
|
### Unmounting invisible children
|
|
131
191
|
|
|
192
|
+
To unmount tab children (remove from the DOM) when they are no longer visible, use the `unmountOnExit` property.
|
|
193
|
+
|
|
132
194
|
```ts file="./TabsUnmountingInvisibleChildren.tsx"
|
|
133
195
|
```
|
|
134
196
|
|
|
135
|
-
### Toggled
|
|
197
|
+
### Toggled tab content
|
|
198
|
+
|
|
199
|
+
You may control tabs from outside of the tabs component. For example, select the "Hide tab 2" button below to make "Tab item 2" invisible.
|
|
200
|
+
|
|
201
|
+
The tab its content should only be mounted when the tab is visible.
|
|
136
202
|
|
|
137
203
|
```ts file="./TabsToggledSeparateContent.tsx"
|
|
138
204
|
```
|
|
139
205
|
|
|
140
|
-
### Dynamic
|
|
206
|
+
### Dynamic tabs
|
|
207
|
+
|
|
208
|
+
To enable closeable tabs, pass the `onClose` property to the `<Tabs>` component. To enable a button that adds new tabs, pass the `onAdd` property to `<Tabs>`.
|
|
141
209
|
|
|
142
|
-
|
|
210
|
+
Aria labels may be controlled manually by passing the `closeButtonAriaLabel` property to a `<Tab>` and the `addButtonAriaLabel` property to `<Tabs>`.
|
|
143
211
|
|
|
144
|
-
```ts file="./TabsDynamic.tsx"
|
|
212
|
+
```ts file="./TabsDynamic.tsx"
|
|
145
213
|
```
|
|
146
214
|
|
|
147
|
-
###
|
|
215
|
+
### With help action popover
|
|
216
|
+
|
|
217
|
+
You may add a help action to a tab to provide users with additional context in a popover.
|
|
218
|
+
|
|
219
|
+
To render an action beside the tab content, use the `actions` property of a `<Tab>`. Pass a popover and a `<TabsAction>` component into the `actions` property.
|
|
148
220
|
|
|
149
221
|
```ts file="./TabsHelp.tsx" isBeta
|
|
150
222
|
```
|
|
151
223
|
|
|
152
|
-
###
|
|
224
|
+
### With help and close actions
|
|
225
|
+
|
|
226
|
+
To add multiple actions to a tab, create a `<TabAction>` component for each action.
|
|
227
|
+
|
|
228
|
+
The following example passes in both help popover and close actions.
|
|
153
229
|
|
|
154
230
|
```ts file="./TabsHelpAndClose.tsx" isBeta
|
|
155
|
-
```
|
|
231
|
+
```
|
|
@@ -23,63 +23,83 @@ KebabToggle
|
|
|
23
23
|
|
|
24
24
|
## Examples
|
|
25
25
|
|
|
26
|
-
###
|
|
26
|
+
### Toolbar items
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
A toolbar can contain multiple toolbar items, like filters and buttons.
|
|
29
|
+
|
|
30
|
+
Note: This example does not demonstrate responsive toolbar behavior. Responsive toolbars are shown in the [examples with toggle groups and filters](/components/toolbar#examples-with-toggle-groups-and-filters).
|
|
29
31
|
|
|
30
32
|
```ts file="./ToolbarItems.tsx"
|
|
31
33
|
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
###
|
|
36
|
+
### Toolbar item spacers
|
|
37
|
+
|
|
38
|
+
You may adjust the space between toolbar items to arrange them into groups. Read our spacers documentation to learn more about using spacers.
|
|
39
|
+
|
|
40
|
+
Items are spaced “16px” apart by default. To adjust the size of the space between items, use the `spacer` property of each `<ToolbarItem>`. You can set the `spacer` value at multiple breakpoints, including "default", "md", "lg", "xl", and "2xl". Available `spacer` values include "spacerNone", "spacerSm", "spacerMd", or "spacerLg" into each breakpoint.
|
|
35
41
|
|
|
36
42
|
```ts file="./ToolbarSpacers.tsx"
|
|
37
43
|
|
|
38
44
|
```
|
|
39
45
|
|
|
40
|
-
###
|
|
46
|
+
### Toolbar items with adjusted widths
|
|
47
|
+
|
|
48
|
+
You can adjust the width of toolbar items so that they better fit the size of their container.
|
|
49
|
+
|
|
50
|
+
The default width of a toolbar item is “100px”. To adjust an item’s width, use the `widths` property of the `<ToolbarItem>`. You can set the “px” value at multiple breakpoints, including "default", "sm", "md", "lg, "xl", and "2xl".
|
|
41
51
|
|
|
42
52
|
```ts file="./ToolbarWidths.tsx"
|
|
43
53
|
|
|
44
54
|
```
|
|
45
55
|
|
|
46
|
-
###
|
|
56
|
+
### With adjusted inset
|
|
57
|
+
|
|
58
|
+
To adjust a toolbar’s inset, use the `inset` property. You can set the inset value at multiple breakpoints, including "default", "md", "lg, "xl", and "2xl". Inset values include “insetNone”, “insetSm”, “insetMd”, “insetLg”, “insetXl”, and “inset2xl”.
|
|
47
59
|
|
|
48
60
|
```ts file="./ToolbarInsets.tsx"
|
|
49
61
|
|
|
50
62
|
```
|
|
51
63
|
|
|
52
|
-
### Sticky
|
|
64
|
+
### Sticky toolbar
|
|
53
65
|
|
|
54
|
-
|
|
66
|
+
To lock a toolbar and prevent it from scrolling with other content, use a sticky toolbar.
|
|
67
|
+
|
|
68
|
+
In the following example, toggle the "is toolbar sticky" checkbox to see the difference between a sticky and non-sticky toolbar.
|
|
55
69
|
|
|
70
|
+
```ts file="./ToolbarSticky.tsx"
|
|
56
71
|
```
|
|
57
72
|
|
|
58
|
-
###
|
|
73
|
+
### With groups of items
|
|
74
|
+
|
|
75
|
+
You can group similar items together to create desired associations and to enable items to respond to changes in viewport width together.
|
|
59
76
|
|
|
60
|
-
|
|
77
|
+
Note: This example does not demonstrate responsive toolbar behavior. Responsive toolbars are shown in the [examples with toggle groups and filters](/components/toolbar#examples-with-toggle-groups-and-filters).
|
|
61
78
|
|
|
62
79
|
```ts file="./ToolbarGroups.tsx"
|
|
63
80
|
|
|
64
81
|
```
|
|
65
82
|
## Examples with toggle groups and filters
|
|
66
83
|
|
|
67
|
-
|
|
84
|
+
The following examples use toggle groups to allow for more responsive and complex toolbars with multiple items and groups of items. To visualize responsive toolbar behavior in the following examples, resize the browser to a smaller screen width.
|
|
85
|
+
|
|
68
86
|
|
|
69
87
|
### Component managed toggle groups
|
|
70
88
|
|
|
89
|
+
A toggle group allows you to collapse a set of items into an overlay panel at a certain breakpoint. For example, when a toggle group contains filter controls, its contents will collapse into an overlay panel when the toolbar adapts to a change in the viewport size. The contents can be toggled by selecting the filter icon in the overlay panel.
|
|
90
|
+
|
|
71
91
|
```ts file="./ToolbarComponentManagedToggleGroups.tsx"
|
|
72
92
|
|
|
73
93
|
```
|
|
74
94
|
|
|
75
95
|
### Consumer managed toggle groups
|
|
76
96
|
|
|
77
|
-
|
|
97
|
+
To manually create the expanded state of the toggle group for smaller screen widths:
|
|
78
98
|
|
|
79
|
-
1. Add a toggleIsExpanded callback to
|
|
80
|
-
2. Pass
|
|
99
|
+
1. Add a `toggleIsExpanded` callback to the toolbar
|
|
100
|
+
2. Pass a boolean into the `isExpanded` property of the toolbar
|
|
81
101
|
|
|
82
|
-
|
|
102
|
+
Note: The toggle group is aware of the consumer provided breakpoint, the expandable content is not. If the expandable content is expanded and the screen width surpasses that of the breakpoint, the expandable content is not aware of that and will remain open. Be sure to consider and handle this in your implementation.
|
|
83
103
|
|
|
84
104
|
```ts file="./ToolbarConsumerManagedToggleGroups.tsx"
|
|
85
105
|
|
|
@@ -87,8 +107,10 @@ If the consumer would prefer to manage the expanded state of the toggle group fo
|
|
|
87
107
|
|
|
88
108
|
### With filters
|
|
89
109
|
|
|
90
|
-
|
|
91
|
-
|
|
110
|
+
You can add filters to a toolbar to let users filter the content that a toolbar manages. When a toolbar is filtered, it will expand in height to make space for a row of filter chips and a "Clear all filters" button. Upon clearing the applied filters, the toolbar will return to its default height.
|
|
111
|
+
|
|
112
|
+
The `<ToolbarFilter>` component expects applied filters and a delete chip handler to be passed in as properties. Pass in a `deleteChipGroup` property to close the entire chip group. Once close, the rendering of chips will be handled responsively by the toolbar.
|
|
113
|
+
|
|
92
114
|
|
|
93
115
|
```ts file="./ToolbarWithFilters.tsx"
|
|
94
116
|
|
|
@@ -96,7 +118,7 @@ When filters are applied, the toolbar will expand in height to make space for a
|
|
|
96
118
|
|
|
97
119
|
### With custom chip group content
|
|
98
120
|
|
|
99
|
-
|
|
121
|
+
To customize the chip groups generated by toolbar filters, use the `customChipGroupContent` property on the `<Toolbar>`. This property will remove the default `clear all filters` button.
|
|
100
122
|
|
|
101
123
|
```ts file="./ToolbarCustomChipGroupContent.tsx"
|
|
102
124
|
|
|
@@ -104,8 +126,8 @@ The chip groups generated by toolbar filters may be further customized through t
|
|
|
104
126
|
|
|
105
127
|
### Stacked example
|
|
106
128
|
|
|
107
|
-
|
|
129
|
+
When all of a toolbar's required elements cannot fit in a single line, you can split toolbar items into multiple rows.
|
|
108
130
|
|
|
109
131
|
```ts file="./ToolbarStacked.tsx"
|
|
110
|
-
|
|
111
132
|
```
|
|
133
|
+
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
Modal,
|
|
9
9
|
Checkbox
|
|
10
10
|
} from '@patternfly/react-core';
|
|
11
|
+
import { DropEvent } from 'react-dropzone';
|
|
11
12
|
import UploadIcon from '@patternfly/react-icons/dist/esm/icons/upload-icon';
|
|
12
13
|
|
|
13
14
|
interface readFile {
|
|
@@ -34,7 +35,7 @@ export const MultipleFileUploadBasic: React.FunctionComponent = () => {
|
|
|
34
35
|
React.useEffect(() => {
|
|
35
36
|
if (readFileData.length < currentFiles.length) {
|
|
36
37
|
setStatusIcon('inProgress');
|
|
37
|
-
} else if (readFileData.every(file => file.loadResult === 'success')) {
|
|
38
|
+
} else if (readFileData.every((file) => file.loadResult === 'success')) {
|
|
38
39
|
setStatusIcon('success');
|
|
39
40
|
} else {
|
|
40
41
|
setStatusIcon('danger');
|
|
@@ -44,39 +45,39 @@ export const MultipleFileUploadBasic: React.FunctionComponent = () => {
|
|
|
44
45
|
// remove files from both state arrays based on their name
|
|
45
46
|
const removeFiles = (namesOfFilesToRemove: string[]) => {
|
|
46
47
|
const newCurrentFiles = currentFiles.filter(
|
|
47
|
-
currentFile => !namesOfFilesToRemove.some(fileName => fileName === currentFile.name)
|
|
48
|
+
(currentFile) => !namesOfFilesToRemove.some((fileName) => fileName === currentFile.name)
|
|
48
49
|
);
|
|
49
50
|
|
|
50
51
|
setCurrentFiles(newCurrentFiles);
|
|
51
52
|
|
|
52
53
|
const newReadFiles = readFileData.filter(
|
|
53
|
-
readFile => !namesOfFilesToRemove.some(fileName => fileName === readFile.fileName)
|
|
54
|
+
(readFile) => !namesOfFilesToRemove.some((fileName) => fileName === readFile.fileName)
|
|
54
55
|
);
|
|
55
56
|
|
|
56
57
|
setReadFileData(newReadFiles);
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
// callback that will be called by the react dropzone with the newly dropped file objects
|
|
60
|
-
const handleFileDrop = (droppedFiles: File[]) => {
|
|
61
|
+
const handleFileDrop = (_event: DropEvent, droppedFiles: File[]) => {
|
|
61
62
|
// identify what, if any, files are re-uploads of already uploaded files
|
|
62
|
-
const currentFileNames = currentFiles.map(file => file.name);
|
|
63
|
-
const reUploads = droppedFiles.filter(droppedFile => currentFileNames.includes(droppedFile.name));
|
|
63
|
+
const currentFileNames = currentFiles.map((file) => file.name);
|
|
64
|
+
const reUploads = droppedFiles.filter((droppedFile) => currentFileNames.includes(droppedFile.name));
|
|
64
65
|
|
|
65
66
|
/** this promise chain is needed because if the file removal is done at the same time as the file adding react
|
|
66
67
|
* won't realize that the status items for the re-uploaded files needs to be re-rendered */
|
|
67
68
|
Promise.resolve()
|
|
68
|
-
.then(() => removeFiles(reUploads.map(file => file.name)))
|
|
69
|
-
.then(() => setCurrentFiles(prevFiles => [...prevFiles, ...droppedFiles]));
|
|
69
|
+
.then(() => removeFiles(reUploads.map((file) => file.name)))
|
|
70
|
+
.then(() => setCurrentFiles((prevFiles) => [...prevFiles, ...droppedFiles]));
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
// callback called by the status item when a file is successfully read with the built-in file reader
|
|
73
74
|
const handleReadSuccess = (data: string, file: File) => {
|
|
74
|
-
setReadFileData(prevReadFiles => [...prevReadFiles, { data, fileName: file.name, loadResult: 'success' }]);
|
|
75
|
+
setReadFileData((prevReadFiles) => [...prevReadFiles, { data, fileName: file.name, loadResult: 'success' }]);
|
|
75
76
|
};
|
|
76
77
|
|
|
77
78
|
// callback called by the status item when a file encounters an error while being read with the built-in file reader
|
|
78
79
|
const handleReadFail = (error: DOMException, file: File) => {
|
|
79
|
-
setReadFileData(prevReadFiles => [
|
|
80
|
+
setReadFileData((prevReadFiles) => [
|
|
80
81
|
...prevReadFiles,
|
|
81
82
|
{ loadError: error, fileName: file.name, loadResult: 'danger' }
|
|
82
83
|
]);
|
|
@@ -95,7 +96,7 @@ export const MultipleFileUploadBasic: React.FunctionComponent = () => {
|
|
|
95
96
|
}
|
|
96
97
|
};
|
|
97
98
|
|
|
98
|
-
const successfullyReadFileCount = readFileData.filter(fileData => fileData.loadResult === 'success').length;
|
|
99
|
+
const successfullyReadFileCount = readFileData.filter((fileData) => fileData.loadResult === 'success').length;
|
|
99
100
|
|
|
100
101
|
return (
|
|
101
102
|
<>
|
|
@@ -123,7 +124,7 @@ export const MultipleFileUploadBasic: React.FunctionComponent = () => {
|
|
|
123
124
|
statusToggleText={`${successfullyReadFileCount} of ${currentFiles.length} files uploaded`}
|
|
124
125
|
statusToggleIcon={statusIcon}
|
|
125
126
|
>
|
|
126
|
-
{currentFiles.map(file => (
|
|
127
|
+
{currentFiles.map((file) => (
|
|
127
128
|
<MultipleFileUploadStatusItem
|
|
128
129
|
file={file}
|
|
129
130
|
key={file.name}
|