@coreui/react
Version:
UI Components Library for React.js
43 lines (42 loc) • 1.57 kB
TypeScript
import React, { HTMLAttributes } from 'react';
export interface CTabsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
/**
* Controls the currently active tab.
*
* When provided, the component operates in a controlled mode.
* You must handle tab switching manually by updating this prop.
*
* @example
* const [activeTab, setActiveTab] = useState(0);
* <CTabs activeItemKey={activeTab} onChange={setActiveTab} />
*/
activeItemKey?: number | string;
/**
* A string of all className you want applied to the base component.
*/
className?: string;
/**
* Sets the initially active tab when the component mounts.
*
* After initialization, the component manages active tab changes internally.
*
* Use `defaultActiveItemKey` for uncontrolled usage.
*
* @example
* <CTabs defaultActiveItemKey={1} />
*/
defaultActiveItemKey?: number | string;
/**
* Callback fired when the active tab changes.
*
* - In controlled mode (`activeItemKey` provided), you must update `activeItemKey` yourself based on the value received.
* - In uncontrolled mode, this callback is called after internal state updates.
*
* @param value - The newly selected tab key.
*
* @example
* <CTabs onChange={(key) => console.log('Tab changed to', key)} />
*/
onChange?: (value: number | string) => void;
}
export declare const CTabs: React.ForwardRefExoticComponent<CTabsProps & React.RefAttributes<HTMLDivElement>>;