Modal dialog with overlay, content area, and close button for Svelte apps.
<!--
Source: https://github.com/pheralb/svgl | License: MIT | Copyright 2022 Pablo Hdez
Provided via justclaw.it.com; keep this notice with the code.
-->
<script lang="ts">
import type { Snippet } from "svelte";
import type { WithoutChildrenOrChild } from "@/types/components";
import { cn } from "@/utils/cn";
import * as Dialog from "./index.js";
import XIcon from "@lucide/svelte/icons/x";
import { Dialog as DialogPrimitive } from "bits-ui";
let {
ref = $bindable(null),
class: className,
portalProps,
children,
showCloseButton = true,
...restProps
}: WithoutChildrenOrChild<DialogPrimitive.ContentProps> & {
portalProps?: DialogPrimitive.PortalProps;
children: Snippet;
showCloseButton?: boolean;
} = $props();
</script>
<Dialog.Porta
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key