Created
November 30, 2016 03:10
-
-
Save guzmonne/adbd2b1d5f59b28fefe449ec96ba90ff to your computer and use it in GitHub Desktop.
UI Fabric Button and Dialog example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react' | |
| import {Fabric} from 'office-ui-fabric-react/lib/Fabric' | |
| import {Button, ButtonType} from 'office-ui-fabric-react/lib/Button' | |
| import {Dialog, DialogType, DialogFooter} from 'office-ui-fabric-react/lib/Dialog' | |
| class App extends Component { | |
| constructor() { | |
| super() | |
| this.state = { | |
| isOpen: false, | |
| } | |
| } | |
| open = () => this.setState({isOpen: true}) | |
| close = () => this.setState({isOpen: false}) | |
| render() { | |
| return ( | |
| <Fabric className="App"> | |
| <div style={{margin: '5em'}}> | |
| <Button onClick={this.open}>I am a button.</Button> | |
| </div> | |
| <Dialog | |
| isOpen={this.state.isOpen} | |
| type={DialogType.close} | |
| onDismiss={this.close.bind(this)} | |
| title='Dialog title' | |
| subText='Dialog subText' | |
| isBlocking={false} | |
| closeButtonAriaLabel='Close' | |
| > | |
| <h1>Hello, World!</h1> | |
| <DialogFooter> | |
| <Button buttonType={ButtonType.primary} onClick={this.close}>OK</Button> | |
| </DialogFooter> | |
| </Dialog> | |
| </Fabric> | |
| ) | |
| } | |
| } | |
| export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment