1.0.4 • Published 5 years ago

@coop/component-popup-box v1.0.4

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

DEPRECATED - Coop Popup Box

React component

The popup box is an alternative to sytem dialogues like alert() and confirm() and can be used anywhere in the application layers.

The component renders outside the main React app, and is destroyed entirely on close. Hence, use like a function call - not jsx.

Pass an object with title, text and an actions array like below.

  import '@coop/component-popup-box/styles.css' // import once somewhere
  import popupBox from '@coop/component-popup-box'

  popupBox({
    title: 'Test',
    text: 'Testing the popup box with a range of random options',
    actions: [
      {
        text: 'Yes',
        secondary: true,
        callback: () => { alert('Clicked yes') }
      },
      {
        text: 'No',
        secondary: true,
        callback: () => { alert('Clicked no') }
      },
      {
        text: 'Cancel'
      }
    ]
  })

Optionally omit callback if the action should do nothing (like cancel).

The secodary prop will apply the alternative button styling to the component.

Props

PropertyPropTypeRequiredDefault Value
titlestringtrue-
textstringfalsenull
actionsarraytrue-
- textstringtrue-
- callbackfunctionfalsenull
- secondaryboolfalsefalse

Part of Coop Trolley

1.0.4

5 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago