You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -130,6 +132,14 @@ Register a callback that will receive the underlying DOM node for every mount. I
130
132
131
133
If you're rendering `react-tabs` within a different `window` context than the default one; for example, an iframe.
132
134
135
+
#### focusTabOnClick: `boolean`
136
+
137
+
> default: `true`
138
+
139
+
By default the tab that is clicked will also be focused in the DOM. If set to `false` the tab will not be focused anymore.
140
+
141
+
> Be aware that keyboard navigation will not work after click if set to false. Though one can still focus the tabs by pressing `tab` and then keyboard navigation will work.
142
+
133
143
#### forceRenderTabPanel: `boolean`
134
144
135
145
> default: `false`
@@ -178,7 +188,7 @@ Provide a custom class name for the active tab panel.
178
188
179
189
If you specify additional props on the `<TabList />` component they will be forwarded to the rendered `<ul />`.
You can also always just simply copy the default style to your own css/scss/less and modify it to your own needs. The changelog will always tell you when classes change and we also consider changes that break the styling as semver major.
353
365
354
366
### Custom Components
355
367
356
368
#### Set `tabsRole`
369
+
357
370
In case you want to create your own component wrapping the ones that the library provides, you have to set its `tabsRole`. This value is used inside react-tabs to check the role of a component inside `<Tabs />`.
358
371
359
372
Possible values for tabsRole are:
360
-
* Tab
361
-
* TabPanel
362
-
* TabList
363
373
364
-
#### Pass through properties
365
-
Note: Because of how react-tabs works internally (it uses cloning to opaquely control various parts of the tab state), you need to pass any incoming props to the component you're wrapping. The easiest way to do this is to use the rest and spread operators, e.g. see `{...otherProps}` below.
374
+
- Tab
375
+
- TabPanel
376
+
- TabList
366
377
378
+
#### Pass through properties
367
379
380
+
Note: Because of how react-tabs works internally (it uses cloning to opaquely control various parts of the tab state), you need to pass any incoming props to the component you're wrapping. The easiest way to do this is to use the rest and spread operators, e.g. see `{...otherProps}` below.
Copy file name to clipboardExpand all lines: src/components/Tabs.js
+9-3
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@ const propTypes = {
23
23
disabledTabClassName: PropTypes.string,
24
24
disableUpDownKeys: PropTypes.bool,
25
25
domRef: PropTypes.func,
26
+
focusTabOnClick: PropTypes.bool,
26
27
forceRenderTabPanel: PropTypes.bool,
27
28
onSelect: onSelectPropType,
28
29
selectedIndex: selectedIndexPropType,
@@ -32,6 +33,7 @@ const propTypes = {
32
33
};
33
34
constdefaultProps={
34
35
defaultFocus: false,
36
+
focusTabOnClick: true,
35
37
forceRenderTabPanel: false,
36
38
selectedIndex: null,
37
39
defaultIndex: null,
@@ -64,7 +66,8 @@ For more information about controlled and uncontrolled mode of react-tabs see ht
64
66
* It is initialized from the prop defaultFocus, and after the first render it is reset back to false. Later it can become true again when using keys to navigate the tabs.
0 commit comments