Confirm

Confirmation dialog for lit-material: await confirm({...}) for destructive actions, with an optional type-the-name-to-confirm field.

  • 7.6 KB gzipped
  • @lit-material/confirm 0.1.6
  • Renders on the server

Example

Install

npm install @lit-material/confirm @lit-material/tokens
import "@lit-material/confirm";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-confirm-dialog>

A confirmation dialog: a headline, a message, Cancel and a confirm button, built on lit-material-dialog. show() resolves true when the visitor confirms and false on Cancel, Escape or a backdrop click.

Properties

PropertyAttributeTypeDefaultDescription
headlineheadlinestring""The question, e.g. "Delete project web?".
messagemessagestring""Supporting text under the headline.
confirmLabelconfirm-labelstring"Confirm"The confirm button's label.
cancelLabelcancel-labelstring"Cancel"The cancel button's label.
destructivedestructivebooleanfalsePaint the confirm button in the error colour.
requireTextrequire-textstring""Text the visitor must type before confirming (empty: no field).
openopenbooleanfalseWhether the dialog is open.
returnValueproperty onlystring"""confirm" or "cancel" once closed.

Events

EventDescription
closeAfter it closes; returnValue is "confirm" or "cancel".

Slots

SlotDescription
defaultThe message; overrides message.

Source on GitHub npm