Skip to content

Countdown

Counts down from a target time, exposing hours, minutes, seconds, and days via slot props.

bash
npm install @vuecs/countdown

Basic 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

PropTypeDefaultDescription
timenumberTime in milliseconds to count down

Slots

SlotPropsDescription
defaultCountdownSlotProps{ days, hours, minutes, seconds }

See also

Released under the Apache 2.0 License.