Backpack dialog component.
Check the main Readme for a complete installation guide.
import { Component } from 'react';
import BpkDialog from '@skyscanner/backpack-web/bpk-component-dialog';
import BpkButton from '@skyscanner/backpack-web/bpk-component-button';
class App extends Component {
constructor() {
super();
this.state = {
isOpen: false,
};
}
onOpen = () => {
this.setState({
isOpen: true,
});
};
onClose = () => {
this.setState({
isOpen: false,
});
};
render() {
return (
<div id="dialog-container">
<div id="pagewrap">
<BpkButton onClick={this.onOpen}>Open dialog</BpkButton>
</div>
<BpkDialog
ariaLabel="example dialog to showcase component"
closeLabel="Close dialog"
id="my-dialog"
className="my-classname"
isOpen={this.state.isOpen}
onClose={this.onClose}
getApplicationElement={() => document.getElementById('pagewrap')}
renderTarget={() => document.getElementById('dialog-container')}
>
This is a dialog. You can put anything you want in here.
</BpkDialog>
</div>
);
}
}
Check out the full list of props on Skyscanner's design system documentation website.