Comments (2)
I just release 4.3.0 that includes the typescript typings. Let me know if that helps.
from react-tabs.
Looks like the @types/react-tabs
package at v5 does not include the types at all anymore - I've resolved this by installing an older version: npm i --save-dev @types/react-tabs@^2.3.4
and extending the interface where required.
edit: this didn't solve it because it was for a much older version. Instead, I added the types in my own codebase based on the master branch:
/**
* Type declarations for react-tabs are added since v5.0, but that requires React 18+.
*
* Types taken from https://github.com/reactjs/react-tabs/blob/main/index.d.ts
*
* This can be removed as soon as we use react-tabs 5.0+
*/
declare module 'react-tabs' {
import {FunctionComponent, HTMLProps} from 'react';
export interface TabsProps
extends Omit<HTMLProps<HTMLDivElement>, 'className' | 'onSelect' | 'ref'> {
className?: string | string[] | {[name: string]: boolean} | undefined;
defaultFocus?: boolean | undefined;
defaultIndex?: number | undefined;
direction?: 'rtl' | 'ltr' | undefined;
disabledTabClassName?: string | undefined;
disableUpDownKeys?: boolean | undefined;
disableLeftRightKeys?: boolean | undefined;
domRef?: ((node?: HTMLElement) => void) | undefined;
environment?: Window | undefined;
focusTabOnClick?: boolean | undefined;
forceRenderTabPanel?: boolean | undefined;
onSelect?: ((index: number, last: number, event: Event) => boolean | void) | undefined;
selectedIndex?: number | undefined;
selectedTabClassName?: string | undefined;
selectedTabPanelClassName?: string | undefined;
}
export interface TabListProps extends Omit<HTMLProps<HTMLUListElement>, 'className'> {
className?: string | string[] | {[name: string]: boolean} | undefined;
}
export interface TabProps extends Omit<HTMLProps<HTMLLIElement>, 'className' | 'tabIndex'> {
className?: string | string[] | {[name: string]: boolean} | undefined;
disabled?: boolean | undefined;
disabledClassName?: string | undefined;
selectedClassName?: string | undefined;
tabIndex?: string | undefined;
}
export interface TabPanelProps extends Omit<HTMLProps<HTMLDivElement>, 'className'> {
className?: string | string[] | {[name: string]: boolean} | undefined;
forceRender?: boolean | undefined;
selectedClassName?: string | undefined;
}
export interface ReactTabsFunctionComponent<P = {}> extends FunctionComponent<P> {
tabsRole: 'Tabs' | 'TabList' | 'Tab' | 'TabPanel';
}
export const Tabs: FunctionComponent<TabsProps>;
export const TabList: FunctionComponent<TabListProps>;
export const Tab: FunctionComponent<TabProps>;
export const TabPanel: FunctionComponent<TabPanelProps>;
}
from react-tabs.
Related Issues (20)
- Property 'tabsRole' is missing in type 'ReactElement<any, any>' but required in type 'ReactTabsFunctionComponent<TabProps> HOT 1
- No content after refresh HOT 5
- about prop types
- UncontrolledTabs.js Eror: Uncaught TypeError: (0 , react__WEBPACK_IMPORTED_MODULE_0__.useId) is not a function HOT 5
- keyboard accessibility of https://reactcommunity.org/react-tabs/ HOT 5
- React-tabs closes React-select (onclick)
- Issues when implementing the same Tabs for different TabPanels HOT 2
- export 'useId' (imported as 'useId') was not found in 'react' HOT 2
- Possible to disable using TabPanel when in controlled mode? HOT 1
- How I can fix this error in react version dependency? HOT 2
- Components Rendering Issue HOT 3
- typo
- React-tabs dropped clicks on tab switch when inspecting on mobile device HOT 1
- defaultProps warning - Support for defaultProps will be removed from function component will be removed HOT 5
- Disabled tabs should remain keyboard focusable as per W3C WAI ARIA guidelines HOT 3
- Support hiding of all TabPanels HOT 1
- How can I stop re-rendering in React when switching between tabs? HOT 7
- How to set the tab container's width to be the width of the widest tab? HOT 1
- Errors when using react-tabs in an Astro page
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-tabs.