Socket
Socket
Sign inDemoInstall

dile-confirm

Package Overview
Dependencies
4
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dile-confirm

Confirm modal box based on LitElement.


Version published
Maintainers
1
Install size
11.2 MB
Created

Readme

Source

Moved

This package has moved and is now available at @dile/dile-confirm. Please update your dependencies. This repository is no longer maintained.

dile-confirm

This is a Web Component to implement a modal confirm box, based on LitElement.

Let's go to DEMOS page!

Use

Install it from npm:

npm i dile-confirm

Place the script In your HTML page or include the dile-confirm.js file in your JS bundle. After that you can use the dile-confirm tag, like this:

<dile-confirm id="myModal">
  <p>
    Delete this file?
  </p>
</dile-confirm>

Whatever you place inside the <dile-confirm> tag will be the content displayed when the modal box opens.

In addition, the confirm box display two buttons inside the modal interface:

  • Cancel button: pressing it, the confirm box closes and dispatchs the dile-confirm-cancelled event
  • Accept button: pressing it, the confirm box closes and dispatchs the dile-confirm-accepted event

Properties

  • opened: Bolean property used to change the confirm modal state, false is closed / true means open.
  • cancelLabel: The text to the cancel button.
  • acceptLabel: The text to the accept button.
  • blocking: Click on the background layer do not closes the confirm box.

Methods

  • open: Use it to open the modal confirm box
  • close: Use it to close the modal confirm box
  • accept: Closes the modal box and dispatch dile-confirm-accepted event
  • cancel: Closes the modal box and dispatch dile-confirm-cancelled event

Custom events

  • dile-confirm-cancelled: Dispatched when the confirm box is cancelled. This occurs when the user press the cancel button or closes the modal box cliking outside.
  • dile-confirm-accepted: Dispatched when the confirm box is accepted. This occurs when the user press the accept button.

Style customization

These are the dile-confirm CSS custom properties. (But remember, you can customize the modal box interface also by using the CSS custom properties of the dile-modal component)

Custom propertyDescriptionDefault
--dile-confirm-accept-button-colorAccept button background color#007bff
--dile-confirm-cancel-button-colorCancel button background color#dc3545
--dile-confirm-accept-text-button-colorAccept button text color#fff
--dile-confirm-cancel-text-button-colorCancel button text color#fff
--dile-confirm-border-radius-buttonButton border radius5px
--dile-confirm-padding-buttonButton padding7px
--dile-confirm-font-size-buttonButton font size1em
--dile-confirm-buttons-text-alignButtons element text alignright
--dile-confirm-text-transformButton text transformationuppercase
--dile-confirm-buttons-margin-topConfirm buttons section margin-top10px
--dile-confirm-buttons-margin-bottomConfirm buttons section margin-bottom10px
--dile-confirm-buttons-margin-leftConfirm buttons section margin-left0
--dile-confirm-buttons-margin-rightConfirm buttons section margin-right0

Keywords

FAQs

Last updated on 21 Jul 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc