Countdowns display an animated countdown to a specific date.
A basic countdown accepts an ActiveSupport::Duration object as either the
first positional argument or as the value of the :duration
keyword
argument.
If you want to display a countdown with multiple parts, you can build one using the ActiveSupport::Duration#build method.
.flex.flex-col.items-center.gap-y-4.font-mono
= daisy_countdown(ActiveSupport::Duration.build(3725))
= daisy_countdown(ActiveSupport::Duration.build(3725), separator: "-")
= daisy_countdown(ActiveSupport::Duration.build(3725), modifier: :letters)
= daisy_countdown(ActiveSupport::Duration.build(3725), modifier: :words)
You can also display the countdowns in a box by customizing each part of the countdown.
Note that the wrapper text-sm
class applies to the words ("hours",
"minutes", and "seconds") and the global parts_css
sets the size of the
numbers.
You can also customize each part individually by using the days_css
,
hours_css
, minutes_css
, and seconds_css
options.
And you can add custom HTML using either the global parts_html
or the
individual days_html
, hours_html
, minutes_html
, and seconds_html
options.
.flex.flex-col.items-center.gap-y-4.text-sm
- box_css = "where:bg-neutral where:text-neutral-content rounded-box flex flex-col items-center justify-center size-24 font-bold [&_span]:font-mono [&_span]:text-5xl"
= daisy_countdown(ActiveSupport::Duration.build(3725),
modifier: :words,
css: "gap-x-8",
parts_css: box_css,
seconds_css: "bg-red-600 text-white",
seconds_html: { title: "You better hurry!" })
Create virtual credit / debit cards to keep your real info safe.
Get $5 when you sign up — free to start!
Everything you need to grow your business with confidence!
CRM, Lead Generation, Project Management, Contracts, Online Payments, and more!
The ads above are affiliate links to products I regularly use and highly
recommend.
I may receive a commission if you decide to purchase.