4.1.10 • Published 2 years ago

bpk-component-dialog-css v4.1.10

Weekly downloads
289
License
Apache-2.0
Repository
github
Last release
2 years ago

bpk-component-dialog

Backpack dialog component.

Installation

npm install bpk-component-dialog --save-dev

Usage

import React, { Component } from 'react';
import BpkDialog from 'bpk-component-dialog';
import BpkButton from '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>
    );
  }
}

Note: In order to "hide" your application from screen readers whilst the dialog is open you need to let it know what the root element for your application is by returning it's DOM node via the function passed to the getApplicationElement prop (see the example above). The pagewrap element id is a convention we use internally at Skyscanner. In most cases it should "just work".

Props

PropertyPropTypeRequiredDefault Value
ariaLabelstringtrue-
childrennodetrue-
getApplicationElementfunctrue-
idstringtrue-
isOpenbooltrue-
classNamestringfalsenull
closeLabelstringfalsenull
dismissibleboolfalsetrue
flareboolfalsefalse
flareClassNamestringfalsenull
headerIconnodefalsenull
headerIconTypeoneOf(HEADER_ICON_TYPES.primary, HEADER_ICON_TYPES.warning, HEADER_ICON_TYPES.destructive)falseHEADER_ICON_TYPES.primary
onClosefuncfalseSee prop details
renderTargetfuncfalsenull

Prop Details

onClose

This is required unless dismissible is false.

flareClassName

This will change the style of the default flare view. Should you wish to apply an image to the flare you would pass the image using the CSS property background-image.

getApplicationElement

This is a function that should return the DOM node of the root of your application, the node returned will be hidden from screen readers when the dialog is displayed. Be careful to return the correct node from this, as on iPhone this element is actually hidden from view also.

Theme Props

  • linkColor
  • linkHoverColor
  • linkActiveColor
  • linkVisitedColor
4.1.10

2 years ago

4.1.7

2 years ago

4.1.5

2 years ago

4.1.4

2 years ago

4.1.2

2 years ago

4.1.1

2 years ago

4.0.19

2 years ago

4.0.21

2 years ago

4.0.27

2 years ago

4.0.28

2 years ago

4.0.18

2 years ago

4.0.30

2 years ago

4.0.33

2 years ago

4.0.17

3 years ago

4.0.13

3 years ago

4.0.10

3 years ago

4.0.8

3 years ago

4.0.7

3 years ago

4.0.6

3 years ago

4.0.5

3 years ago

4.0.4

3 years ago

4.0.3

3 years ago

4.0.2

3 years ago

4.0.1

3 years ago

3.1.8

3 years ago

4.0.0

3 years ago

3.1.6

3 years ago

3.1.5

3 years ago

3.1.4

3 years ago

3.1.3

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.17

3 years ago

3.0.18

3 years ago

3.0.16

3 years ago

3.0.15

3 years ago

3.0.14

3 years ago

3.0.12

3 years ago

3.0.13

3 years ago

3.0.11

3 years ago

3.0.10

3 years ago

3.0.9

3 years ago

3.0.8

3 years ago

3.0.7

3 years ago

3.0.6

3 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.2.26

3 years ago

2.2.24

3 years ago

2.2.25

3 years ago

2.2.23

3 years ago

2.2.22

3 years ago

2.2.21

3 years ago

2.2.20

3 years ago

2.2.19

3 years ago

2.2.18

3 years ago

2.2.17

3 years ago

2.2.16

3 years ago

2.2.15

3 years ago

2.2.14

3 years ago

2.2.11

3 years ago

2.2.10

3 years ago

2.2.9

3 years ago

2.2.8

3 years ago

2.2.7

4 years ago

2.2.6

4 years ago

2.2.5

4 years ago

2.2.4

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.86

4 years ago

2.0.85

4 years ago

2.0.83

4 years ago

2.0.82

4 years ago

2.0.81

4 years ago

2.0.76

4 years ago

2.0.74

4 years ago

2.0.73

4 years ago

2.0.71

4 years ago

2.0.70

4 years ago

2.0.69

4 years ago

2.0.68

4 years ago