JSPM

@workday/canvas-kit-react-popup

3.4.1-next.15+3601ebf
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 71
  • Score
    100M100P100Q104503F
  • License Apache-2.0

Popup to display some content on top of another

Package Exports

  • @workday/canvas-kit-react-popup

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@workday/canvas-kit-react-popup) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Canvas Kit Popup

A Popup component that allows you to render content above another.

Note: This popup does not include a positioning engined. In our example we use Material UIs popper component to wrap our Popup component and position it, which is a wrapper to Popper.js. For reference: https://material-ui.com/api/popper/

Installation

yarn add @workday/canvas-kit-react

or

yarn add @workday/canvas-kit-react-popup

Usage

import * as React from 'react';
import Popper from '@material-ui/core/Popper';
import {Popup} from '@workday/canvas-kit-react-popup';

// We use Popper from Material UI for our positioning
<Popper placement={'bottom'} open={this.state.open} anchorEl={anchorEl}>
  <Popup
    width={300}
    heading={'Popup Title'}
    padding={Popup.Padding.l}
    handleClose={this.handleClose}
  >
    {this.props.children}
  </Popup>
</Popper>;

Static Properties

Padding: PopupPadding

<Popup padding={Popup.Padding.l}>{this.props.children}</Popup>

Component Props

Required

None


Optional

padding: PopupPadding

You can choose between zero, s, l for your padding

Default: PopupPadding.l

Name Size (px)
zero 0
s 16
l 32

handleClose: () => void

Callback to handle close of your Popup and any other event when the Popup is closed.


width: number | string

Width of the card.


closeLabel: string

Aria label string for the close icon button


depth: CanvasDepthValue

Depth of the card. Style imported from @workday/canvas-kit-react-core.

Default: depth[2]


transformOrigin: TransformOrigin

Origin from which the popup will animate from

Default:

{
  horizontal: 'center',
  vertical: 'top',
}

heading: ReactNode

Heading at the top of the card.


closeIconSize: IconButtonSize

The size of the close icon button (small or medium)


popupRef: React.Ref<HTMLDivElement>

A ref to the underlying popup container element. Use this to check click targets against when closing a popup.