<Modaltitle="Terms of Service" {modalStatus} {closeModal}>
Modal content
</Modal>
Default
<scriptlang="ts">import { Modal, Button, uiHelpers } from'svelte-5-ui-lib';
const modalExample = uiHelpers();
let modalStatus = $state(false);
const closeModal = modalExample.close;
$effect(() => {
modalStatus = modalExample.isOpen;
});
</script><divclass="flex justify-center"><Buttononclick={modalExample.toggle}>Default modal</Button></div><Modaltitle="Terms of Service" {modalStatus} {closeModal}><pclass="text-base leading-relaxed text-gray-500 dark:text-gray-400">
With less than a month to go before the European Union enacts new consumer privacy laws for its
citizens, companies around the world are updating their terms of service agreements to comply.
</p><pclass="text-base leading-relaxed text-gray-500 dark:text-gray-400">
The European Union’s General Data Protection Regulation (G.D.P.R.) goes into effect on May 25
and is meant to ensure a common set of data rights in the European Union. It requires
organizations to notify users as soon as possible of high-risk data breaches that could
personally affect them.
</p></Modal>
Popup
<scriptlang="ts">import { Modal, Button, uiHelpers } from'svelte-5-ui-lib';
import { ExclamationCircleOutline } from'flowbite-svelte-icons';
const modalExample = uiHelpers();
let modalStatus = $state(false);
const closeModal = modalExample.close;
$effect(() => {
modalStatus = modalExample.isOpen;
});
</script><divclass="flex justify-center"><Buttononclick={modalExample.toggle}>Pop-up modal</Button></div><Modalsize="xs" {modalStatus} {closeModal}><divclass="text-center"><ExclamationCircleOutlineclass="mx-auto mb-4 h-12 w-12 text-gray-400 dark:text-gray-200" /><h3class="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">
Are you sure you want to delete this product?
</h3><Buttoncolor="red"class="me-2">Yes, I'm sure</Button><Buttoncolor="alternative">No, cancel</Button></div></Modal>
<scriptlang="ts">import { Modal, Button, uiHelpers } from'svelte-5-ui-lib';
const modalExample = uiHelpers();
let modalStatus = $state(false);
const closeModal = modalExample.close;
$effect(() => {
modalStatus = modalExample.isOpen;
});
</script><divclass="flex justify-center"><Buttononclick={modalExample.toggle}>Pop-up modal</Button></div><Modaltitle="Terms of Service" {modalStatus} {closeModal} outsideClose={false}>
{#snippet footer()}
<Buttononclick={() => alert('Handle "success"')}>I accept</Button><Buttoncolor="alternative"onclick={closeModal}>Decline</Button>
{/snippet}
<!-- Modal body --><pclass="text-base leading-relaxed text-gray-500 dark:text-gray-400">
With less than a month to go before the European Union enacts new consumer privacy laws for its
citizens, companies around the world are updating their terms of service agreements to comply.
</p><pclass="text-base leading-relaxed text-gray-500 dark:text-gray-400">
The European Union’s General Data Protection Regulation (G.D.P.R.) goes into effect on May 25
and is meant to ensure a common set of data rights in the European Union. It requires
organizations to notify users as soon as possible of high-risk data breaches that could
personally affect them.
</p></Modal>
<scriptlang="ts">import { Modal, Button, uiHelpers } from'svelte-5-ui-lib';
const modalExample = uiHelpers();
let modalStatus = $state(false);
const closeModal = modalExample.close;
$effect(() => {
modalStatus = modalExample.isOpen;
});
</script><divclass="flex justify-center"><Buttononclick={modalExample.toggle}>Default modal</Button></div><Modal {modalStatus} {closeModal}>
{#snippet header()}
<h2class="weight-bold text-xl text-pink-700">Terms of Service</h2>
{/snippet}
<!-- Modal body --><pclass="text-base leading-relaxed text-gray-500 dark:text-gray-400">
With less than a month to go before the European Union enacts new consumer privacy laws for its
citizens, companies around the world are updating their terms of service agreements to comply.
</p><pclass="text-base leading-relaxed text-gray-500 dark:text-gray-400">
The European Union’s General Data Protection Regulation (G.D.P.R.) goes into effect on May 25
and is meant to ensure a common set of data rights in the European Union. It requires
organizations to notify users as soon as possible of high-risk data breaches that could
personally affect them.
</p></Modal>
Footer snippet
<scriptlang="ts">import { Modal, Button, uiHelpers } from'svelte-5-ui-lib';
const modalExample = uiHelpers();
let modalStatus = $state(false);
const closeModal = modalExample.close;
$effect(() => {
modalStatus = modalExample.isOpen;
});
</script><divclass="flex justify-center"><Buttononclick={modalExample.toggle}>Default modal</Button></div><Modaltitle="Terms of Service" {modalStatus} {closeModal}>
{#snippet footer()}
<Buttononclick={() => alert('Handle "success"')}>I accept</Button><Buttoncolor="alternative"onclick={closeModal}>Decline</Button>
{/snippet}
<!-- Modal body --><pclass="text-base leading-relaxed text-gray-500 dark:text-gray-400">
With less than a month to go before the European Union enacts new consumer privacy laws for its
citizens, companies around the world are updating their terms of service agreements to comply.
</p><pclass="text-base leading-relaxed text-gray-500 dark:text-gray-400">
The European Union’s General Data Protection Regulation (G.D.P.R.) goes into effect on May 25
and is meant to ensure a common set of data rights in the European Union. It requires
organizations to notify users as soon as possible of high-risk data breaches that could
personally affect them.
</p></Modal>