Getting Started
Components
- Accordion
- Advanced Toast
- AlertMessage
- ArrowButton
- Arrows
- Avatar
- Backdrop
- Basic Toast
- Breadcrumb
- Button
- CardBackground
- Card
- Carousel
- Chapters
- ChatBody
- ChatButton
- ChatHeader
- ChatInput
- ChatMessageActions
- ChatMessageEditor
- ChatMessage
- ChatTypingIndicator
- ChatWindowCsatPrompt
- ChatWindowQuote
- ChatWindow
- CheckboxSelect
- Checkbox
- Checkboxes
- Chip
- ChoiceExpander
- Clickable
- ContentReview
- Countdown
- CriteriaDates
- CriteriaParticipants
- CriteriaTransports
- Date Field
- Datepicker
- Dropdown
- ElasticHeight
- ExpandableCard
- ExpandableText
- Filter
- FloatingLabelTextField
- Form Control
- Form Label
- Frame
- HamburgerIcon
- Heading
- Image
- JourneyCard
- LayerHeader
- Layer
- Link
- Loader
- Number Field
- PageNavigation
- Pagination
- Paragraph
- Password
- Phone Field
- Popin
- Portal
- ProductThumbnail
- Promises
- Prose
- Radio Group
- RadioSelect
- Radio
- Range
- Scrollbar
- Select
- SidebarLayout
- SliderFrame
- SparkleWrapper
- Spinner
- Switch
- Table
- Tabs
- Tag
- TextField
- Toggle
- Tooltip
- ValidationMessage
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
'use client';
import { Countdown } from '@/ui/Countdown';
const labels = {
days: 'days',
hours: 'hours',
minutes: 'minutes',
seconds: 'seconds',
};
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
const nextWeek = new Date();
nextWeek.setDate(nextWeek.getDate() + 7);
export function CountdownDemo() {
return (
<div className="flex flex-col gap-8">
<Countdown countdown={{ to: tomorrow.toISOString(), labels }} theme="saffron" />
<div className="bg-ultramarine p-6 rounded-16">
<Countdown
countdown={{ to: nextWeek.toISOString(), labels }}
theme="white"
className="text-white"
/>
</div>
</div>
);
}
Installation
npx shadcn@latest add https://develop.trident-ui.pro.clubmed/r/countdown.json
Usage
'use client';
import { Countdown } from '@/ui/Countdown';
export function Component() {
const target = new Date();
target.setDate(target.getDate() + 1);
return (
<Countdown
countdown={{
to: target.toISOString(),
labels: {
days: 'days',
hours: 'hours',
minutes: 'minutes',
seconds: 'seconds',
},
}}
theme="saffron"
/>
);
}API Reference
Countdown
| Prop | Type | Default | Description |
|---|---|---|---|
countdown | { to: string; labels: CountdownLabels } | required | Target date (ISO string) and display labels for each unit |
theme | Theme | "white" | Color theme applied to the flip-card digits |
className | string | undefined | Additional CSS classes for the outer wrapper |
CountdownLabels
| Prop | Type | Description |
|---|---|---|
days | string | Label shown below the days digits |
hours | string | Label shown below the hours digits |
minutes | string | Label shown below the minutes digits |
seconds | string | Label shown below the seconds digits |
Notes
- Flip animation: Each digit transitions with a 3D flip effect when its value changes, using the
animate-tick/animate-tockkeyframes defined in the trident-ui CSS. - Leading zero dimming: Units whose value is 0 and whose higher-order units are also 0 are rendered with the
blacktheme to indicate they are inactive. - Direction: The component always renders
dir="ltr"regardless of the document direction, so digit order stays consistent. - Client component: Uses
setIntervalviauseEffectand must be rendered in a client context ('use client'). - Accessibility: The wrapper has
role="timer"so assistive technologies announce it as a timer landmark. - Stopping: The interval is cleared automatically when the target date is reached; no further re-renders occur after expiry.