Skip to content

Commit

Permalink
feat(AdaptiveTabs): allow to control some properties in More control (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Raubzeug authored Feb 21, 2024
1 parent d1f5157 commit e7c2a4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/AdaptiveTabs/AdaptiveTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ export interface AdaptiveTabsProps<T> {
size?: TabsSize;
/** Allows you not to specify activeTab */
allowNotSelected?: boolean;
/** Settings to control popup with hidden tabs list */
moreControlProps?: Pick<SelectProps, 'virtualizationThreshold' | 'popupWidth'>;
}

interface AdaptiveTabsState {
Expand Down Expand Up @@ -858,7 +860,7 @@ export class AdaptiveTabs<T> extends React.Component<AdaptiveTabsProps<T>, Adapt
renderSelect() {
const activeTabID = this.activeTab;
const {firstHiddenTabIndex, tabChosenFromSelectId} = this.state;
const {items} = this.props;
const {items, moreControlProps} = this.props;

const itemsForSelect = items
.slice(firstHiddenTabIndex, items.length)
Expand All @@ -880,6 +882,7 @@ export class AdaptiveTabs<T> extends React.Component<AdaptiveTabsProps<T>, Adapt
filterable={false}
renderControl={this.renderSwitcherForMoreSelect}
onOpenChange={this.handleOpenSelectChange}
{...moreControlProps}
/>
);
}
Expand Down
1 change: 1 addition & 0 deletions src/components/AdaptiveTabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ with the caption `More'. If only one tab fits, the select is displayed instead o
| wrapTo | `wrapTo?(item: TabItemProps, node: React.ReactNode, index: number): void` | | | Allows to wrap TabItem into another component or render custom tab |
| className | `String` | | | Class name for the tabs container |
| [breakpointsConfig](#breakpointsConfig) | `Record<string, number>` | | | Breakpoints config which control the thersholds of tab size. |
| moreControlProps | `{popupWidth?: 'fit' \| number; virtualizationThreshold?: number;}` | | | Settings to control popup with hidden tabs list |

### breakpointsConfig

Expand Down

0 comments on commit e7c2a4e

Please sign in to comment.