Global options

You can configure options globally by assigning an object to the variable "window.UseBootstrapDialogOptions". For example:

window.UseBootstrapDialogOptions = {
  alert: {
    modalDialogClassName: 'modal-lg',
  },
  confirm: {
    title: {
      html: '<h5>Confirmación</h5>',
    },
    html: 'Está seguro ?',
    footer: {
      cancelBtn: {
        html: 'Cancelar',
      },
      okBtn: {
        className: 'btn-danger',
      },
    },
  },
  prompt: {
    closeBtn: false,
  },
}

Each method prioritizes object options followed by global options and lastly default options.

Default options

Here are the default options for each method:

const defaultAlertOptions = {
  closeBtn: true,
}

const defaultConfirmOptions = {
  html: 'Are you sure ?',
  title: {
    html: '<h5>Confirmation</h5>',
    closeBtn: true,
  },
  footer: {
    cancelBtn: {
      className: 'btn-secondary',
      html: 'Cancel',
    },
    okBtn: {
      className: 'btn-primary',
      html: 'OK',
    },
  },
}

const defaultPromptOptions = {
  required: false,
  closeBtn: true,
  footer: {
    cancelBtn: {
      className: 'btn-secondary',
      html: 'Cancel',
    },
    okBtn: {
      className: 'btn-primary',
      html: 'OK',
    },
  },
}

Available options

Here are the available options for each method:

// Alert
interface AlertOptions {
  text?: string
  html?: string
  closeBtn?: boolean
  staticBackdrop?: boolean
  modalDialogClassName?: string
}

// Confirm
interface ConfirmOptions {
  callback: (confirmed: boolean) => any
  text?: string
  html?: string
  staticBackdrop?: boolean
  modalDialogClassName?: string
  title?: {
    text?: string
    html?: string
    closeBtn?: boolean
  }
  footer?: {
    cancelBtn?: {
      text?: string
      html?: string
      className?: string
      attributes?: Record<string, string>
    }
    okBtn?: {
      text?: string
      html?: string
      className?: string
      attributes?: Record<string, string>
    }
  }
}

// Prompt
interface PromptOptions {
  callback: (value: string) => any
  text?: string
  html?: string
  closeBtn?: boolean
  staticBackdrop?: boolean
  modalDialogClassName?: string
  defaultValue?: string
  required?: boolean
  footer?: {
    cancelBtn?: {
      text?: string
      html?: string
      className?: string
      attributes?: Record<string, string>
    }
    okBtn?: {
      text?: string
      html?: string
      className?: string
      attributes?: Record<string, string>
    }
  }
}