nb-countdown

This is a countdown component for Vue.js 3+.

Look at the console to see the triggered event

Installation

Yarn
yarn add @vlalg-nimbus/nb-time
NPM
npm install @vlalg-nimbus/nb-time

Usage

Vue 3
import { createApp } from 'vue'
import App from './App.vue'

import NbTimeComponents from '@vlalg-nimbus/nb-time'
import "@vlalg-nimbus/nb-time/dist/style.css";

const app = createApp(App)
app.use(NbTimeComponents)
app.mount('#app')
Nuxt 3
import NbTimeComponents from '@vlalg-nimbus/nb-time'
import "@vlalg-nimbus/nb-time/dist/style.css";

export default defineNuxtPlugin(context => {
  context.vueApp.use(NbTimeComponents)
})

To use, simply call the component, in this case it will be NbCountdown or nb-countdown.

Mode 1
<template>
  <NbCountdown />
</template>
Mode 2
<template>
  <nb-countdown />
</template>
Mode 3
<template>
  <nb-countdown></nb-countdown>
</template>

Preview & Playground

Select the component you want to edit/test

Loading Sandbox...

Props

Items with an (*) mean they are required

nameValue typeDefaultDescription
nbId (*)StringSets the id attribute to differentiate from other components
textColorString'#000'Defines the text color. Accepts Color name and Hex
numberColorString'#000'Defines the number text color. Accepts Color name and Hex
separatorColorString'#000'Defines the separator color. Accepts Color name and Hex
borderBooleantrueDefines whether the countdown has a border.
borderColorString'#000'Defines the border color. Accepts Color name and Hex
dayNumber1Defines the countdown day. Accepts numbers between 1 and 31, numbers from 1 to 9 do not need to be supplied with 0 before.
monthString'jan'Defines the countdown month. Defines the countdown month. Accepted jan, feb, mar, apr, may, jun, jul, aug, sept, oct, nov or dec.
yearNumber9999Defines the countdown month. Accepts any year equal to or greater than the current year, but with 4 characters (xxxx).
hourNumber0Defines the countdown hour. Accepts numbers between 0 and 23, numbers from 1 to 9 do not need to be supplied with 0 before.
minuteNumber0Defines the countdown minute. Accepts numbers between 0 and 59, numbers from 1 to 9 do not need to be supplied with 0 before.
secondNumber0Defines the countdown second. Accepts numbers between 0 and 59, numbers from 1 to 9 do not need to be supplied with 0 before.
daysTextString'days'Defines the text that appears below the number of days.
hoursTextString'hours'Defines the text that appears below the number of hours.
minutesTextString'minutes'Defines the text that appears below the number of minutes.
secondsTextString'seconds'Defines the text that appears below the number of seconds.
showDaysBooleantrueDefines whether the number of days should be shown.
showHoursBooleantrueDefines whether the number of hours should be shown.
showMinutesBooleantrueDefines whether the number of minutes should be shown.
showSecondsBooleantrueDefines whether the number of seconds should be shown.
separatorBooleantrueDefines whether the separator should be shown.
separatorTypeString'/'Defines the separator.
fontFamilyString"'Lato', sans-serif"Defines the font-family
fontSizeNumberNumber2.5Defines the number text font-size
fontSizeTextNumber1.3Defines the text font-size
fontSizeSeparatorNumber3Defines the separator font-size
fontWeightNumberNumber900Defines the number font-weight
fontWeightTextNumber300Defines the text font-weight
fontWeightSeparatorNumber900Defines the number font-weight
containerWidthNumber256Defines width. Used to fix wrapper size when changing fontSizeNumber, fontSizeText, fontSizeSeparator, fontWeightNumber, fontWeightText and fontWeightSeparator props. You may not need to change if you use the default settings.
containerHeightNumber43Defines height. Used to fix wrapper size when changing fontSizeNumber, fontSizeText, fontSizeSeparator, fontWeightNumber, fontWeightText and fontWeightSeparator props. You may not need to change if you use the default settings.

Events

nameReturn typeDescription
startednothingFired when the countdown is started, returns nothing.
finishednothingFired when the countdown is finished, returns nothing.