<arc-countdown-timer> Overview
Guidelines
When to use
- Use for event countdowns, product launches, and sale timers
- Provide a meaningful label like "Launches In" or "Offer Ends"
- Set a custom expired message relevant to the context (e.g., "Now Live!")
- Use hide-zero-segments when the countdown is under 24 hours
- Place inside a Section or Card for visual context
When not to use
- Use for elapsed time or stopwatch functionality — this counts down only
- Set a target date in the past unless you want the expired state immediately
- Place more than one or two countdowns on a single page — they compete for attention
- Rely solely on the visual countdown for critical deadlines — provide server-side enforcement
- Use extremely short countdowns (under 10 seconds) as primary UI — the urgency feels manipulative
Features
- Live countdown updating every second via setInterval
- Automatic cleanup of interval timer in disconnectedCallback
- Gradient-accent number text with tabular-nums for stable layout
- Card-style segments with hover glow effect
- Dispatches arc-expired custom event when countdown reaches zero
- Configurable expired text via the expired attribute
- Optional label with gradient accent text above the countdown
- hide-zero-segments attribute to suppress leading zero segments
- Respects prefers-reduced-motion by disabling transitions
- CSS parts for container, segment, number, label, and separator
Preview
Usage
This component requires JavaScript. No pure HTML/CSS version is available — use the Web Component directly or a framework wrapper.
<!-- New Year countdown -->
<arc-countdown-timer
target="2026-12-31T00:00:00"
label="New Year"
></arc-countdown-timer>
<!-- Product launch with custom expired text -->
<arc-countdown-timer
target="2026-06-15T09:00:00"
label="Launches In"
expired="Now Live!"
></arc-countdown-timer>
<!-- Short countdown, hiding zero segments -->
<arc-countdown-timer
target="2026-03-01T18:00:00"
hide-zero-segments
></arc-countdown-timer> import { CountdownTimer } from '@arclux/arc-ui-react';
function LaunchBanner({ launchDate }) {
return (
<CountdownTimer
target={launchDate}
label="Launches In"
expired="Now Live!"
onArcExpired={() => console.log('Countdown finished!')}
/>
);
} <script setup>
import { CountdownTimer } from '@arclux/arc-ui-vue';
const launchDate = '2026-12-31T00:00:00';
function handleExpired() {
console.log('Countdown finished!');
}
</script>
<template>
<CountdownTimer
:target="launchDate"
label="New Year"
expired="Happy New Year!"
@arc-expired="handleExpired"
/>
</template> <script>
import { CountdownTimer } from '@arclux/arc-ui-svelte';
const target = '2026-12-31T00:00:00';
</script>
<CountdownTimer
{target}
label="New Year"
expired="Happy New Year!"
on:arc-expired={() => console.log('Done!')}
/> import { Component } from '@angular/core';
import { CountdownTimer } from '@arclux/arc-ui-angular';
@Component({
imports: [CountdownTimer],
template: `
<CountdownTimer
target="2026-12-31T00:00:00"
label="New Year"
expired="Happy New Year!"
(arc-expired)="onExpired()"
/>
`,
})
export class CountdownComponent {
onExpired() {
console.log('Countdown finished!');
}
} import { CountdownTimer } from '@arclux/arc-ui-solid';
function LaunchCountdown() {
return (
<CountdownTimer
target="2026-12-31T00:00:00"
label="New Year"
expired="Happy New Year!"
/>
);
} import { CountdownTimer } from '@arclux/arc-ui-preact';
function LaunchCountdown() {
return (
<CountdownTimer
target="2026-12-31T00:00:00"
label="New Year"
expired="Happy New Year!"
/>
);
} API
| Prop | Type | Default | Description |
|---|---|---|---|
target | string | '' | ISO date string or parseable date for the countdown target |
label | string | '' | Optional label displayed above the countdown |
expired | string | 'Expired' | Text shown when the countdown reaches zero |
hide-zero-segments | boolean | false | Hide leading segments that are zero |
Events
| Event | Description |
|---|---|
arc-expired | Fired when the countdown reaches zero |
See Also
- Animated Number Smooth count-up/down number animation with formatting options.
- Stat Numeric statistic display with gradient value and label.
- Badge Compact pill-shaped label for status indicators, category tags, and notification counts. Three color variants let you encode meaning at a glance across dashboards, tables, and card layouts.