1.3.0 • Published 11 months ago

@forter/confirm v1.3.0

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

fc-confirm

An element by Forter

Usage

<script>
   import '@forter/confirm';
</script>

<fc-confirm opened>
  Are you sure you want to continue?
</fc-confirm>

Examples

<!-- confirm-button-text -->

<fc-confirm opened title="example" confirm-button-text="Foo">confirm text is changed!</fc-confirm>

<!-- cancel-button-text -->

<fc-confirm opened title="example" cancel-button-text="Foo">cancel text is changed</fc-confirm>

<!-- hide-confirm-button -->

<fc-confirm opened title="example" hide-confirm-button>confirm text is changed!</fc-confirm>

<!-- hide-cancel-button -->

<fc-confirm opened title="example" hide-cancel-button>confirm text is changed!</fc-confirm>

<!-- confirm -->

<p> Open: </p>
<fc-button
  onclick="
  FC.confirm({
    title: 'Example',
    content: 'Are you a Forker?',
    confirmButtonText: 'Yes',
    cancelButtonText: 'No'
  })
.then((confirmed)=> confirmed ?
    FC.toast.success({ message: 'You answered yes!'}) :
    FC.toast.danger({ message: 'You answered no!'})
)"
>
Click me!
</fc-button>
<fc-confirm></fc-confirm>

Properties

PropertyAttributeTypeDefaultDescription
cancelButtonTextcancel-button-textstring"Cancel"the text displayed inside the cancel modal
confirmButtonTextconfirm-button-textstring"Confirm"the text displayed inside the confirm button
heightheightstringnullOptional height for the modal
hideCancelButtonhide-cancel-buttonstringfalseHides the cancel button if ture
hideConfirmButtonhide-confirm-buttonstringfalseHides the confirm button if ture
openedopenedbooleanfalsewhether the confirm is open
titletitlestringnullthe text displayed inside the confirm button

Events

EventDescription
on-cancelwhen the cancel/close button was clicked
on-confirmwhen the confirm button was clicked
on-openedwhen opening a confirm you get this event

CSS Custom Properties

PropertyDescription
--fc-confirm-heightheight
--fc-confirm-widthwidth