Files
heroui-vue/apps/docs/demos/modal-custom-backdrop.vue
T

52 lines
1.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import {
Button,
Modal,
ModalBackdrop,
ModalBody,
ModalClose,
ModalCloseTrigger,
ModalContainer,
ModalDialog,
ModalFooter,
ModalHeader,
ModalHeading,
ModalIcon,
} from "@heroui-vue/components";
import { IconSparkles as Sparkles } from "@tabler/icons-vue";
</script>
<template>
<Modal>
<Button variant="secondary">自定义背景</Button>
<ModalBackdrop
class="bg-linear-to-t from-black/80 via-black/40 to-transparent dark:from-zinc-800/80 dark:via-zinc-800/40"
variant="blur"
>
<ModalContainer>
<ModalDialog class="sm:max-w-[360px]">
<ModalHeader class="items-center text-center">
<ModalIcon class="bg-accent-soft text-accent-soft-foreground">
<Sparkles aria-hidden="true" class="size-5"></Sparkles>
</ModalIcon>
<ModalHeading>高级背景</ModalHeading>
</ModalHeader>
<ModalBody>
<p>
此背景采用从底部深色过渡到顶部完全透明的精致渐变,并配合柔和的模糊效果。渐变会在浅色与深色模式下自动调整强度,以获得最佳对比度。
</p>
</ModalBody>
<ModalFooter class="flex-col-reverse">
<ModalClose as-child>
<Button class="w-full">Amazing!</Button>
</ModalClose>
<ModalClose as-child>
<Button class="w-full" variant="secondary">关闭</Button>
</ModalClose>
</ModalFooter>
<ModalCloseTrigger></ModalCloseTrigger>
</ModalDialog>
</ModalContainer>
</ModalBackdrop>
</Modal>
</template>