Closed opensas closed 1 week ago
currently, using shadcn-svelte I did this dirty workaround:
type $$Props = DialogPrimitive.ContentProps & { hideCloseButton?: boolean };
let className: $$Props['class'] = undefined;
export let hideCloseButton = false;
[...]
</script>
<Dialog.Portal>
<Dialog.Overlay />
<DialogPrimitive.Content
[...]
>
<slot />
{#if !hideCloseButton}
<DialogPrimitive.Close
[...]
</DialogPrimitive.Close>
{/if}
</DialogPrimitive.Content>
</Dialog.Portal>
Just dont render the close button until your condition is met, or call e.preventDefault
on the click handler of the close button.
Describe the feature in detail (code, mocks, or screenshots encouraged)
Add properties to prevent the Dialog from being closed by the user
usage: display a "loading please wait" dialog. the dialog will be programmatically close when the process finishes (I couldn't find a way to hide the X button, perhaps there's an easy solution that I missed)
could be a preventScroll: boolean or (also) a showCloseButton (or hideCloseButton): boolean
What type of pull request would this be?
Enhancement
Provide relevant links or additional information.
No response