@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
76 lines (75 loc) • 2.62 kB
TypeScript
/**
*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React from 'react';
type TabId = string | number;
type Size = 'small' | 'large';
type Fill = 'underline' | 'filled';
export interface BaseTabsProps<T extends TabId> {
/**
* The currently active tabId
*/
value: T;
/**
* Event when a new tab is selected. Receives the newly selected
* tabId as the value
*/
onChange: (e: T) => void;
children: React.ReactNode | string;
fill?: Fill;
size?: Size;
className?: string;
}
interface TabProps<T extends TabId> {
tabId: T;
children: React.ReactNode | string;
className?: string;
isDisabled?: boolean;
}
interface TabPanelProps {
children: React.ReactNode;
/**
* The currently selected tabId. Determines if
* this tab is visible or not
*/
value: TabId;
tabId: TabId;
className?: string;
}
declare const Tabs: (<U extends TabId, T extends React.ElementType = "div">(props: BaseTabsProps<U> & {
as?: T | undefined;
htmlAttributes?: import("../_common/types").HtmlAttributes<T> | undefined;
className?: string;
style?: React.CSSProperties;
} & React.RefAttributes<unknown>) => React.ReactElement | null) & {
Tab: <U extends TabId = TabId, T extends React.ElementType = "button">(props: TabProps<U> & {
as?: T | undefined;
htmlAttributes?: import("../_common/types").HtmlAttributes<T> | undefined;
className?: string;
style?: React.CSSProperties;
} & React.RefAttributes<unknown>) => React.ReactElement | null;
TabPanel: React.ForwardRefExoticComponent<TabPanelProps & {
as?: React.ElementType<any> | undefined;
htmlAttributes?: import("../_common/types").HtmlAttributes<React.ElementType<any>> | undefined;
className?: string;
style?: React.CSSProperties;
} & React.RefAttributes<unknown>>;
};
export { Tabs };