From 8bcb5f7b7220f6e139b287bf707d6eba811777fb Mon Sep 17 00:00:00 2001 From: srinidhi <91565397+srinidhi9831@users.noreply.github.com> Date: Mon, 29 Jan 2024 19:09:24 +0530 Subject: [PATCH] [lab][TabContext] Support number type in `value` (#40829) Co-authored-by: S Srinidhi --- docs/pages/material-ui/api/tab-context.json | 5 ++++- packages/mui-lab/src/TabContext/TabContext.d.ts | 2 +- packages/mui-lab/src/TabContext/TabContext.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/pages/material-ui/api/tab-context.json b/docs/pages/material-ui/api/tab-context.json index 165bbe9cb41145..9a6e0b870f4894 100644 --- a/docs/pages/material-ui/api/tab-context.json +++ b/docs/pages/material-ui/api/tab-context.json @@ -1,6 +1,9 @@ { "props": { - "value": { "type": { "name": "string" }, "required": true }, + "value": { + "type": { "name": "union", "description": "number
| string" }, + "required": true + }, "children": { "type": { "name": "node" } } }, "name": "TabContext", diff --git a/packages/mui-lab/src/TabContext/TabContext.d.ts b/packages/mui-lab/src/TabContext/TabContext.d.ts index f37f7c88a3f22e..b3db92467f8936 100644 --- a/packages/mui-lab/src/TabContext/TabContext.d.ts +++ b/packages/mui-lab/src/TabContext/TabContext.d.ts @@ -13,7 +13,7 @@ export interface TabContextProps { /** * The value of the currently selected `Tab`. */ - value: string; + value: string | number; } /** * diff --git a/packages/mui-lab/src/TabContext/TabContext.js b/packages/mui-lab/src/TabContext/TabContext.js index c4332280d7bc4d..a910236bab70b1 100644 --- a/packages/mui-lab/src/TabContext/TabContext.js +++ b/packages/mui-lab/src/TabContext/TabContext.js @@ -41,7 +41,7 @@ TabContext.propTypes /* remove-proptypes */ = { /** * The value of the currently selected `Tab`. */ - value: PropTypes.string.isRequired, + value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, }; /**