Skip to content

Modal

te-modal is a dialog rendered through <Teleport> into <body>, so it is never clipped by a parent's overflow.

Usage

Not shown inline — it covers the page.

vue
<te-button @click="open = true">Open</te-button>

<te-modal v-model:visible="open" title="Delete this item?">
  This cannot be undone.
  <template #footer>
    <te-button type="light" @click="open = false">Cancel</te-button>
    <te-button type="danger" @click="remove">Delete</te-button>
  </template>
</te-modal>

Props

PropTypeDefaultDescription
visiblebooleanfalseSupports v-model:visible.
titlestring''Header text, and the accessible name.
size'' | 'sm' | 'lg' | 'xl'''Dialog width.
centeredbooleanfalseVertically centred.
scrollablebooleanfalseScrolls the body instead of the page.
showCloseButtonbooleantrueClose button in the header.
closeOnBackdropbooleantrueClicking the backdrop closes it.
hideHeader / hideFooterbooleanfalseDrops that section.
componentComponent | stringundefinedRenders a component in the body instead of the slot.
componentProps / componentEventsobject{}Bound to that component.

Events

EventPayloadDescription
update:visiblebooleanVisibility changed.
closeThe modal was closed from inside.

Slots

SlotPropsDescription
defaultBody.
headerReplaces the title.
footerFooter.

Released under the MIT License.