LayerwiseLayerwise
  • Features
  • Pricing
  • Templates
  • Docs
DownloadDownload
FeaturesPricingTemplatesDocsAI Website BuilderVibe CodingPersonal Software
DownloadDownload
  1. Glossary
  2. /
  3. Components

Date picker

Also called datepicker, calendar picker, or date range picker

A form control that opens a small calendar so people can pick a date, or a range of dates, by clicking days.

import { useState } from 'react';
import { Popover } from '@base-ui/react/popover';

const WEEKDAYS = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
const MONTH_YEAR = { month: 'long', year: 'numeric' } as const;
const FULL_DATE = { weekday: 'short', month: 'short', day: 'numeric' } as const;

export function PublishDatePicker() {
  const today = new Date(new Date().setHours(0, 0, 0, 0));
  const [page, setPage] = useState(0); // months after the current one
  const [selected, setSelected] = useState<Date>();
  const [y, m] = [today.getFullYear(), today.getMonth() + page];
  const count = new Date(y, m + 1, 0).getDate(); // days in this month
  const days = Array.from({ length: count }, (_, i) => new Date(y, m, i + 1));
  const blanks = new Date(y, m, 1).getDay(); // empty cells before the 1st

  return (
    <Popover.Root>
      <Popover.Trigger className='h-10 w-56 rounded-lg border px-3 text-left text-sm'>
        {selected?.toLocaleDateString('en-US', FULL_DATE) ?? 'Pick a date'}
      </Popover.Trigger>
      <Popover.Portal>
        <Popover.Positioner align='start' sideOffset={6}>
          <Popover.Popup className='grid w-72 grid-cols-7 gap-1 rounded-xl border bg-background p-3 text-center text-sm shadow-lg [&>span]:text-xs [&>span]:text-muted-foreground'>
            <button
              onClick={() => setPage(page - 1)}
              aria-label='Previous month'
            >
              ‹
            </button>
            <Popover.Title className='col-span-5 font-medium'>
              {new Date(y, m).toLocaleDateString('en-US', MONTH_YEAR)}
            </Popover.Title>
            <button onClick={() => setPage(page + 1)} aria-label='Next month'>
              ›
            </button>
            {WEEKDAYS.map((weekday) => (
              <span key={weekday}>{weekday}</span>
            ))}
            {blanks > 0 && <i style={{ gridColumn: `span ${blanks}` }} />}
            {days.map((day) => (
              // Popover.Close picks the day and closes the calendar in one click.
              <Popover.Close
                key={day.getDate()}
                disabled={day < today}
                onClick={() => setSelected(day)}
                data-selected={+day === +(selected ?? 0) || undefined}
                className='h-9 rounded-md tabular-nums enabled:not-data-selected:hover:bg-muted disabled:opacity-30 data-selected:bg-blue-600 data-selected:text-white'
              >
                {day.getDate()}
              </Popover.Close>
            ))}
          </Popover.Popup>
        </Popover.Positioner>
      </Popover.Portal>
    </Popover.Root>
  );
}
Add a date range picker to the booking form: clicking the field opens a one-month calendar below it, the first click sets check-in, the second sets check-out, and the nights between get a light blue highlight. Disable past dates, slide the month grid 24px with a fade over 200ms when paging, and support arrow keys, Page Up/Page Down, Enter, and Escape.

Paste into Layerwise or any AI coding tool.

What is Date picker?

A date picker pairs a text field with a calendar grid. Clicking the field opens the calendar right below it, arrows page between months, and clicking a day fills in the field. A range picker takes two clicks, a start and an end, and shades the days in between.

Use it when the day matters in context, such as booking a stay, scheduling a meeting, or filtering a report by date range. For a birthday or another date far in the past, separate month, day, and year fields are faster than paging back through decades of calendars.

Let people type the date as well, and show the expected format. Disable days that cannot be chosen, like past dates or fully booked nights. A complete picker works from the keyboard: arrow keys move between days, Page Up and Page Down change the month, Enter picks, and Escape closes.

The browser’s built-in <input type="date"> is accessible and works well on phones. Reach for a custom picker when you need ranges, custom styling, or extra information on each day, such as prices.

Related terms

All terms

Popover

A small floating panel anchored to the button that opened it, often with an arrow, holding a few controls and closing when you click outside.

Combobox

A text field with a dropdown list that filters as you type, so people can pick one option from a long list quickly.

Direction-aware transition

A transition that slides new content in from the side you are heading toward, so going forward and going back move in opposite directions.

Inline validation

Form checking that happens right next to each field as you fill it in, showing an error or a checkmark before you press Submit.

Build it with Layerwise

Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.

DownloadDownloadRead the docs
LayerwiseLayerwise

Build full-stack web apps in minutes with AI.

Product

  • Features
  • Pricing
  • Download
  • Templates

Solutions

  • AI Website Builder
  • Vibe Coding
  • Personal Software

Resources

  • Documentation
  • Changelog
  • Blog
  • Vibe Coding Glossary
  • llms.txt
  • llms-full.txt

Company

  • About
  • Contact

Legal

  • Privacy
  • Analytics Privacy
  • Terms
  • Security
  • Abuse

© 2026 Layerwise. All rights reserved.

Entrances & exits

  • Fade in
  • Slide in
  • Scale in
  • Pop in
  • Blur in
  • Reveal animation
  • Enter and exit animations

Timing & sequencing

  • Duration
  • Delay
  • Keyframes
  • Tweening
  • Stagger
  • Orchestration
  • Fill mode
  • Stepped animation
  • Looping animation
  • Yoyo animation

Easing

  • Easing
  • Linear easing
  • Ease-in
  • Ease-out
  • Ease-in-out
  • Cubic-bezier
  • Asymmetric easing
  • Overshoot easing

Springs & physics

  • Spring animation
  • Stiffness
  • Damping
  • Mass
  • Bounce
  • Velocity
  • Momentum
  • Interruptible animation
  • Rubber-banding

Transforms

  • Translate
  • Scale
  • Rotate
  • Skew
  • 3D flip
  • Perspective
  • Transform origin
  • Origin-aware animation

State transitions

  • Crossfade
  • Morph
  • Shared element transition
  • Layout animation
  • Height auto animation
  • Direction-aware transition
  • Continuity transition
  • Page transition
  • View Transitions API

Scroll effects

  • Scroll reveal
  • Scroll-driven animation
  • Parallax scrolling
  • Scrollytelling
  • Scroll pinning
  • Horizontal scroll section
  • Scroll progress bar
  • Scroll snap
  • Smooth scrolling

Interaction feedback

  • Hover effect
  • Press feedback
  • Ripple effect
  • Shake animation
  • Hold to confirm
  • Drag gesture
  • Drag to reorder
  • Swipe to dismiss
  • Pull to refresh
  • Magnetic button
  • Custom cursor
  • 3D tilt card
  • Spotlight card

Text effects

  • Typewriter effect
  • Text scramble
  • Split text animation
  • Text morph
  • Rotating words
  • Gradient text
  • Shimmer text
  • Number ticker
  • Tabular numbers
  • Underline animation

Loops & ambient motion

  • Marquee
  • Pulse animation
  • Float animation
  • Orbit animation
  • Idle animation
  • Particle background
  • Border beam
  • Confetti
  • Animated gradient

Visual effects

  • Blur
  • Clip-path
  • Mask
  • Before/after slider
  • SVG line drawing
  • Lottie animation

Motion principles

  • Purposeful animation
  • Anticipation
  • Follow-through
  • Squash and stretch
  • Perceived performance
  • Frequency of use
  • Spatial consistency
  • Reduced motion

Animation performance

  • Frame rate (FPS)
  • Jank
  • GPU acceleration
  • will-change
  • Layout thrashing

Layout

  • Hero section
  • Above the fold
  • Sticky header
  • Sidebar
  • Bento grid
  • Card
  • Flexbox
  • CSS Grid
  • Padding vs margin
  • Responsive design
  • Container
  • Masonry layout
  • Split screen
  • Z-index
  • Overflow

Components

  • Button variants
  • Modal
  • Drawer
  • Popover
  • Tooltip
  • Dropdown menu
  • Context menu
  • Toast notification
  • Tabs
  • Segmented control
  • Accordion
  • Carousel
  • Command palette
  • Combobox
  • Toggle switch
  • Checkbox
  • Radio button
  • Date picker
  • Breadcrumb
  • Pagination
  • Infinite scroll
  • Badge
  • Avatar stack
  • Empty state
  • Skeleton screen
  • Spinner
  • Progress bar
  • Data table
  • Stepper
  • Floating label
  • Inline validation
  • Alert banner
  • Tag input

States & patterns

  • Interaction states
  • Focus ring
  • Loading state
  • Optimistic UI
  • Debounce
  • Lazy loading
  • Dark mode
  • Micro-interaction
  • Affordance
  • Undo
  • Drag and drop
  • Keyboard shortcut

Visual styles

  • Glassmorphism
  • Liquid glass
  • Neumorphism
  • Claymorphism
  • Neo-brutalism
  • Skeuomorphism
  • Flat design
  • Mesh gradient
  • Aurora background
  • Grain texture
  • Glow effect
  • Drop shadow
  • Border radius
  • Grid background
  • Typographic hierarchy
  • Accent color
  • Color contrast

Vibe coding & AI

  • Vibe coding
  • Prompt
  • Context window
  • Token
  • AI agent
  • Tool call
  • Hallucination
  • Diff
  • Live preview
  • Checkpoint
  • Git commit
  • Deploy
  • Frontend and backend
  • API
  • Database
  • Rules file
  • MCP
  • Plan mode
  • Visual edit