5.2.1 • Published 9 months ago

@leafygreen-ui/confirmation-modal v5.2.1

Weekly downloads
19
License
Apache-2.0
Repository
github
Last release
9 months ago

Confirmation Modal

npm (scoped)

View on MongoDB.design

Installation

Yarn

yarn add @leafygreen-ui/confirmation-modal

NPM

npm install @leafygreen-ui/confirmation-modal

Example

import ConfirmationModal from '@leafygreen-ui/confirmation-modal';

function ExampleComponent() {
  const [open, setOpen] = useState(false);

  return (
    <>
      <button onClick={() => setOpen(!open)}>Open Modal</button>
      <ConfirmationModal
        open={open}
        confirmButtonProps={{
          children: 'confirm',
          onClick: () => setOpen(false),
          disabled: true,
        }}
        cancelButtonProps={{
          onClick: () => setOpen(false),
          variant: 'default',
        }}
        title="Confirm Title Here"
        requiredInputText="confirm"
      >
        This is some description text, and it is extra long so it fills up this
        modal. Another thing about the modals here. This is some description
        text, and it is extra long so it fills up this modal. Another thing
        about the modals here.
      </ConfirmationModal>
    </>
  );
}

Properties

PropTypeDescriptionDefault
confirmButtonPropsButtonPropsThe confirm button on the right. An object that accepts all Button props except variant. The variant of the confirm button is controlled by the variant prop. The text is confirm by default but can by overridden with the children property.
cancelButtonPropsButtonPropsThe cancel button on the left. An object that accepts all Button props. except children. The text will always render cancel and the onClick property will also fire when the X button, or backdrop is clicked.
openbooleanDetermines open state of Modal componentfalse
titlestringTitle text to display above the main content text.
childrennodeChildren that will be rendered inside <ConfirmationModal /> component.
variant'default', 'danger'Sets the style variant.'default'
requiredInputTextstringIf provided, a text prompt will be displayed and the confirmation button will be disabled until the text prompt is filled out with the required text.
classNamestringStyle to be applied to the container's root node.
darkModebooleanDetermines if the component will appear in dark mode.false
onConfirm(Deprecated)functionCallback that fires when the action is confirmed. This can be used to set the modal to be closed. @deprecated - use confirmButtonProps and pass the onClick property() => {}
buttonText(Deprecated)stringText content of the confirmation button. @deprecated - use confirmButtonProps and pass the children property.
submitDisabled(Deprecated)booleanDetermines if the submit button should appear as disabled @deprecated - use confirmButtonProps and pass the disabled propertyfalse
onCancel(Deprecated)functionCallback that fires when the cancel button, x button, or backdrop is clicked. This can be used to set the modal to be closed. @deprecated - use cancelButtonProps and pass the onClick property() => {}
5.2.1

9 months ago

5.1.0

1 year ago

5.2.0

1 year ago

5.0.14

1 year ago

5.0.13

1 year ago

5.0.12

1 year ago

5.0.11

1 year ago

5.0.10

1 year ago

5.0.9

1 year ago

5.0.0-alpha.1

2 years ago

5.0.0-alpha.0

2 years ago

4.0.10

2 years ago

5.0.8

2 years ago

5.0.7

2 years ago

5.0.6

2 years ago

5.0.5

2 years ago

5.0.4

2 years ago

5.0.3

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

4.0.8-next.6

2 years ago

4.0.8-next.7

2 years ago

4.0.8-next.0

2 years ago

4.0.8-next.1

2 years ago

4.0.8-next.4

2 years ago

4.0.8-next.5

2 years ago

4.0.8-next.2

2 years ago

4.0.8-next.3

2 years ago

4.0.7

2 years ago

4.0.9

2 years ago

4.0.8

2 years ago

4.0.5

2 years ago

4.0.6

2 years ago

4.0.4

2 years ago

4.0.3

2 years ago

3.1.4

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

4.0.2

2 years ago

3.1.0-test.1

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.1.0-test.0

3 years ago

3.1.0-next.1

3 years ago

3.1.0-next.0

3 years ago

3.1.0-next.2

3 years ago

3.0.7

3 years ago

3.0.6

3 years ago

3.0.4

3 years ago

3.0.5

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.3

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.6

4 years ago

2.1.5

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago