Files
heroui-vue/apps/docs/demos/calendar-custom-styles.vue
T
2026-10-24 20:59:19 +08:00

45 lines
1.9 KiB
Vue

<script setup lang="ts">
import {
Calendar,
CalendarHeader,
CalendarHeading,
CalendarNavButton,
CalendarGrid,
CalendarGridHeader,
CalendarGridBody,
CalendarHeaderCell,
CalendarCell,
} from "@heroui-vue/components";
</script>
<template>
<Calendar
aria-label="自定义样式日历"
class="w-63 rounded-2xl border border-border/80 bg-surface p-3 shadow-sm ring-1 ring-accent/5 dark:border-border/90 dark:ring-accent/10"
>
<CalendarHeader class="px-0.5 pb-4">
<CalendarHeading class="text-sm font-medium text-foreground" />
<CalendarNavButton
class="text-accent-soft-foreground hover:bg-default hover:text-accent-soft-foreground active:scale-95"
slot="previous"
/>
<CalendarNavButton
class="text-accent-soft-foreground hover:bg-default hover:text-accent-soft-foreground active:scale-95"
slot="next"
/>
</CalendarHeader>
<CalendarGrid>
<CalendarGridHeader v-slot="{ day }">
<CalendarHeaderCell class="pb-2 text-xs font-medium text-muted">
{{ day }}
</CalendarHeaderCell>
</CalendarGridHeader>
<CalendarGridBody v-slot="{ date }">
<CalendarCell
class="rounded-3xl hover:bg-default data-[hovered=true]:bg-default data-[outside-month=true]:text-muted data-[outside-month=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[selected=true]:hover:bg-accent-hover data-[selected=true]:data-[hovered=true]:bg-accent-hover data-[selected=true]:data-[outside-month=true]:bg-default data-[today=true]:bg-accent-soft data-[today=true]:text-accent-soft-foreground data-[today=true]:hover:bg-accent-soft-hover data-[today=true]:data-[hovered=true]:bg-accent-soft-hover data-[selected=true]:data-[today=true]:bg-accent data-[selected=true]:data-[today=true]:hover:bg-accent-hover"
:date="date"
/>
</CalendarGridBody>
</CalendarGrid>
</Calendar>
</template>