Countdown
Counts down from a target time, exposing hours, minutes, seconds, and days via slot props.
bash
npm install @vuecs/countdownBasic usage
1h 0m 0s remaining
vue
<script setup lang="ts">
import { VCCountdown } from '@vuecs/countdown';
const time = 3600 * 1000;
</script>
<template>
<VCCountdown :time="time">
<template #default="props">
<span class="font-medium">
{{ props.hours }}h
{{ props.minutes }}m
{{ props.seconds }}s
</span>
remaining
</template>
</VCCountdown>
</template>css
@import "tailwindcss";
@import "@vuecs/design";
@custom-variant dark (&:where(.dark, .dark *));Props
| Prop | Type | Default | Description |
|---|---|---|---|
time | number | — | Time in milliseconds to count down |
Slots
| Slot | Props | Description |
|---|---|---|
default | CountdownSlotProps | { days, hours, minutes, seconds } |