- Welcome
- Getting started
- Latest updates
- Foundations
-
Components
- Accordion
- Alert
- Alignment
- App Search Modal
- Aria live
- Autosuggest
- Badge
- Banner alert
- Bar chart
- Blockquote
- Bottom navigation
- Bottom sheet
- Breadcrumb
- Breakpoint
- Button
- Calendar
- Card
- Card list
- Card button
- Carousel
- Checkbox
- Chip
- Chip group
- Code
- Content cards
- Data Table
- Datepicker
- Description list
- Dialog
- Divider
- Drawer
- Field Set
- Flare
- Flat list
- Flight leg
- Floating action button
- Floating notification
- Form label
- Form validation
- Graphic promotion
- Horizontal navigation
- Icon
- Image
- Image Gallery
- Infinite scroll
- Info Banner
- Inset Banner
- Link
- List
- Map
- Mobile scroll container
- Modal
- Navigation bar
- Navigation Tab Group
- Nudger
- Overlay
- Page indicator
- Pagination
- Panel
- Phone input
- Picker
- Popover
- Price
- Progress bar
- Radio button
- Rating
- Rating Bar
- Scrollable calendar
- Search Modal
- Section header
- Section list
- Select
- Skeleton
- Skip link
- Slider
- Snackbar
- Snippet
- Spinner
- Split input
- Star rating
- Swap Button
- Switch
- Table
- Text
- Text input
- Theming
- Ticket
- Toast
- Tooltip
- Touchable native feedback
- Touchable overlay
- Search Input Summary
- Content
- Accessibility
- Contributing
- Localisation
Popover
Popovers display related content or functionality that is related to a particular element.
Default
With title
Popovers can be configured to have a title, this is displayed at the top opposite a close button.
With title & text button
As above, but with the close button displayed as text.
On the side
Attach to external element
Opened by an input
You can use a BpkInput enhanced with the withOpenEvents higher-order component to open popovers.
bpk-component-popover
Backpack popover component.
Installation
Check the main Readme for a complete installation guide.
Usage
import { createRef } from 'react';
import BpkButton from '@skyscanner/backpack-web/bpk-component-button';
import BpkPopover from '@skyscanner/backpack-web/bpk-component-popover';
import BpkText from '@skyscanner/backpack-web/bpk-component-text';
class App extends Component {
constructor() {
super();
this.ref = createRef();
this.state = {
isOpen: false,
};
}
openPopover = () => {
this.setState({
isOpen: true,
});
}
closePopover = () => {
this.setState({
isOpen: false,
});
}
const target = (
<div ref={this.ref} className={'my-popover-target'}>
<BpkButton
onClick={this.openPopover}>
Open
</BpkButton>
</div>
)
render() {
return (
<div id="popover-container">
<BpkPopover
id="my-popover"
target={target}
onClose={this.closePopover}
isOpen={this.state.isOpen}
label="My popover"
closeButtonText="Close"
renderTarget={() =>
document.getElementById('popover-container')
}
closeButtonProps={{
tabIndex: 0,
}}
>
<BpkText>My popover content</BpkText>
</BpkPopover>
</div>
);
}
}
Props
Check out the full list of props on Skyscanner's design system documentation website.
Props
Made with ❤️ by Skyscanner © 2024
© 2024 Skyscanner Backpack. Page last updated on Oct 2, 2023, 16:01