Components
Loading preview...
Composable date range picker built on React Aria DateRangePicker with DateField and RangeCalendar composition.
npx shadcn@latest add https://21st.dev/r/hero_ui/heroui-date-range-picker"use client";
import { DateRangePicker, parseZonedDateTime } from "@/components/ui/heroui-date-range-picker";
const dateRange = {
start: parseZonedDateTime("2026-02-03T08:45:00[Asia/Tbilisi]"),
end: parseZonedDateTime("2026-02-10T18:45:00[Asia/Tbilisi]"),
};
const sourcePreviewEndTime = "6:45";
export default function FormatOptionsDemo() {
return (
<div className="flex min-h-screen w-full items-center justify-center overflow-hidden bg-background p-8">
<style>{`
.format-options-demo{width:24rem;display:flex;flex-direction:column;gap:1.5rem;color:inherit}
.format-options-title{font-size:14px;line-height:20px;font-weight:500}
.format-options-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem 2rem}
.format-options-field{display:flex;min-width:0;flex-direction:column;gap:.5rem;font-size:.875rem;font-weight:500;line-height:1.25rem;color:inherit}
.format-options-select{display:flex;height:2.25rem;align-items:center;justify-content:space-between;border-radius:.75rem;background:#27272a;color:#fafafa;padding:0 .75rem;font-size:.875rem;font-weight:400}
.format-options-menu{display:flex;flex-direction:column;gap:2px;border-radius:12px;border:1px solid hsl(var(--border,240 4% 24%));background:hsl(var(--popover,240 6% 10%));padding:4px;font-size:13px;color:inherit}
.format-options-menu span{border-radius:8px;padding:4px 8px}.format-options-menu span:first-child{background:rgb(124 58 237);color:white}
.format-options-select svg{width:1rem;height:1rem;color:#a1a1aa}
.format-options-switches{display:flex;flex-direction:column;gap:.75rem}
.format-options-switch-row{display:flex;align-items:center;gap:.75rem;font-size:.875rem;font-weight:500;line-height:1.25rem;color:inherit}
.format-options-switch{position:relative;width:2.5rem;height:1.25rem;border-radius:999px;background:#27272a;box-shadow:inset 0 0 0 1px rgba(255,255,255,.04)}
.format-options-switch::after{content:"";position:absolute;left:.125rem;top:.125rem;width:1rem;height:1rem;border-radius:999px;background:#fafafa;box-shadow:0 1px 2px rgba(0,0,0,.18)}
html:not(.dark) .format-options-select{background:#f4f4f5;color:#18181b}.format-options-select svg{color:#71717a}
html:not(.dark) .format-options-switch{background:#e4e4e7}.format-options-switch::after{background:white}
html:not(.dark) .format-options-menu{background:white;border-color:hsl(var(--border,240 5.9% 90%))}
`}</style>
<div className="format-options-demo">
<DateRangePicker label="Date range" value={dateRange} showTime minWidth="min-w-96" />
<span className="format-options-title">Format Options</span>
<div className="format-options-controls">
<label className="format-options-field">
<span>Granularity</span>
<span className="format-options-select">Minute<svg viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M2.97 5.47a.75.75 0 0 1 1.06 0L8 9.44l3.97-3.97a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 0 1 0-1.06"/></svg></span>
<span className="format-options-menu"><span>Day</span><span>Hour</span><span>Minute</span><span>Second</span></span>
</label>
<label className="format-options-field">
<span>Hour cycle</span>
<span className="format-options-select">12-hour<svg viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M2.97 5.47a.75.75 0 0 1 1.06 0L8 9.44l3.97-3.97a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 0 1 0-1.06"/></svg></span>
<span className="format-options-menu"><span>12-hour</span><span>24-hour</span></span>
</label>
</div>
<div className="format-options-switches">
<label className="format-options-switch-row"><span className="format-options-switch" aria-hidden="true" />Hide timezone</label>
<label className="format-options-switch-row"><span className="format-options-switch" aria-hidden="true" />Force leading zeros</label>
</div>
</div>
</div>
);
}
export { FormatOptionsDemo };