office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
1 lines • 1.18 kB
JavaScript
module.exports = "import * as React from 'react';\r\nimport {\r\n Label,\r\n Button,\r\n Pivot,\r\n PivotItem\r\n} from '../../../../index';\r\n\r\nexport class PivotOverrideExample extends React.Component<any, any> {\r\n constructor(props: any) {\r\n super(props);\r\n\r\n this.state = {\r\n selectedKey: 0\r\n };\r\n\r\n this._handleClick = this._handleClick.bind(this);\r\n }\r\n\r\n public render() {\r\n return (\r\n <div>\r\n <Pivot selectedKey={`${this.state.selectedKey}`}>\r\n <PivotItem linkText='My Files' itemKey='0'>\r\n <Label>Pivot #1</Label>\r\n </PivotItem>\r\n <PivotItem linkText='Recent' itemKey='1'>\r\n <Label>Pivot #2</Label>\r\n </PivotItem>\r\n <PivotItem linkText='Shared with me' itemKey='2'>\r\n <Label>Pivot #3</Label>\r\n </PivotItem>\r\n </Pivot>\r\n <Button onClick={ this._handleClick }>\r\n Select next item\r\n </Button>\r\n </div>\r\n );\r\n }\r\n\r\n private _handleClick(): void {\r\n this.setState({ selectedKey: (this.state.selectedKey + 1) % 3 });\r\n }\r\n}\r\n";