Hero Ui

DatePicker

Forms 2

About

Composable date picker built on React Aria DatePicker with DateField and Calendar composition.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds DatePicker to your project and fits it to your theme.

Code

How DatePicker is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { DatePicker } from "@/components/ui/heroui-date-picker";

const dateTime = { month: "2", day: "3", year: "2026", iso: "2026-02-03", display: "2|/|3|/|2026|,\u00A0|\u20668:45\u2069| AM GMT+4" };

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:20rem;display:flex;flex-direction:column;gap:1.5rem;color:inherit}
        .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:#f4f4f5;color:#18181b;padding:0 .75rem;font-size:.875rem;font-weight:400;box-shadow:0 1px 2px rgba(0,0,0,.04)}
        .format-options-select svg{width:1rem;height:1rem;color:#71717a}
        .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:#e4e4e7;box-shadow:inset 0 0 0 1px rgba(0,0,0,.04)}
        .format-options-switch::after{content:"";position:absolute;left:.125rem;top:.125rem;width:1rem;height:1rem;border-radius:999px;background:white;box-shadow:0 1px 2px rgba(0,0,0,.18)}
        .dark .format-options-select{background:#27272a;color:#fafafa;box-shadow:none}
        .dark .format-options-select svg{color:#a1a1aa}
        .dark .format-options-switch{background:#27272a}.dark .format-options-switch::after{background:#fafafa}
      `}</style>
      <div className="format-options-demo">
        <DatePicker label="Date and time" value={dateTime} showTime minWidth="min-w-72" />
        <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>
          </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>
          </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 };

More by Hero Ui

View all
  • Chip

    Chip

    449
  •  The Pagination

    The Pagination

    368
  • HeroUI Table

    HeroUI Table

    124
  • HeroUI Color Picker

    HeroUI Color Picker

    115
  • Skeleton

    Skeleton

    108
  • HeroUI Disclosure Group

    HeroUI Disclosure Group

    98
  • HeroUI AlertDialog

    HeroUI AlertDialog

    85
  • ComboBox

    ComboBox

    78

More in Forms

View all
  • Premium Auth

    Premium Auth

    593
  • Contact Form

    Contact Form

    28
  • Form

    Form

    4
  • Login 1

    Login 1

    70
  • Book A Demo 1

    Book A Demo 1

    94
  • Contact Card

    Contact Card

    1.1K
  • HeroUI Field Error

    HeroUI Field Error

    13
  • Form [react-aria-components]

    Form [react-aria-components]

    19