office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
75 lines (74 loc) • 2.09 kB
TypeScript
/// <reference types="react" />
import { BaseComponent } from '../../Utilities';
import { IPivotProps } from './Pivot.types';
import { IPivotItemProps } from './PivotItem.types';
/**
* Usage:
*
* <Pivot>
* <PivotItem linkText="Foo">
* <Label>Pivot #1</Label>
* </PivotItem>
* <PivotItem linkText="Bar">
* <Label>Pivot #2</Label>
* </PivotItem>
* <PivotItem linkText="Bas">
* <Label>Pivot #3</Label>
* </PivotItem>
* </Pivot>
*/
export interface IPivotState {
links: IPivotItemProps[];
selectedKey: string;
selectedTabId: string;
}
export declare class PivotBase extends BaseComponent<IPivotProps, IPivotState> {
private _keyToIndexMapping;
private _keyToTabIds;
private _pivotId;
private focusZone;
private _classNames;
constructor(props: IPivotProps);
componentWillReceiveProps(nextProps: IPivotProps): void;
/**
* Sets focus to the first pivot tab.
*/
focus(): void;
render(): JSX.Element;
/**
* Renders the set of links to route between pivots
*/
private _renderPivotLinks();
private _renderPivotLink;
private _renderLinkContent;
/**
* Renders the current Pivot Item
*/
private _renderPivotItem;
/**
* Gets the set of PivotLinks as arrary of IPivotItemProps
* The set of Links is determined by child components of type PivotItem
*/
private _getPivotLinks(props);
/**
* Generates the Id for the tab button.
*/
private _getTabId(itemKey, index);
/**
* whether the key exists in the pivot items.
*/
private _isKeyValid(itemKey);
/**
* Handles the onClick event on PivotLinks
*/
private _onLinkClick(itemKey, ev);
/**
* Handle the onKeyPress eventon the PivotLinks
*/
private _onKeyPress(itemKey, ev);
/**
* Updates the state with the new selected index
*/
private _updateSelectedItem(itemKey, ev?);
private _getClassNames(props);
}