UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

80 lines (73 loc) 2.08 kB
let { PrimaryButton, DefaultButton, ChoiceGroup, Panel, PanelType, Fabric } = window.Fabric; class PanelSmallRightExample extends React.Component< {}, { showPanel: boolean; } > { constructor(props: {}) { super(props); this.state = { showPanel: false }; } public render(): JSX.Element { return ( <div> <DefaultButton secondaryText="Opens the Sample Panel" onClick={this._onShowPanel} text="Open Panel" /> <Panel isOpen={this.state.showPanel} type={PanelType.smallFixedFar} onDismiss={this._onClosePanel} headerText="Panel - Small, right-aligned, fixed, with footer" closeButtonAriaLabel="Close" onRenderFooterContent={this._onRenderFooterContent} > <ChoiceGroup options={[ { key: 'A', text: 'Option A' }, { key: 'B', text: 'Option B', checked: true }, { key: 'C', text: 'Option C', disabled: true }, { key: 'D', text: 'Option D', checked: true, disabled: true } ]} label="Pick one" required={true} /> </Panel> </div> ); } private _onClosePanel = (): void => { this.setState({ showPanel: false }); }; private _onRenderFooterContent = (): JSX.Element => { return ( <div> <PrimaryButton onClick={this._onClosePanel} style={{ marginRight: '8px' }}> Save </PrimaryButton> <DefaultButton onClick={this._onClosePanel}>Cancel</DefaultButton> </div> ); }; private _onShowPanel = (): void => { this.setState({ showPanel: true }); }; } ReactDOM.render(<PanelSmallRightExample />, document.getElementById('content'));