Astryx

Astryx Date Range Input

Component

About

DateRangeInput lets users select a start and end date from a dual-month calendar popover. Use it for filtering data by time period, report generation, analytics dashboards, and booking flows. Astryx by Meta. Source: https://astryx.atmeta.com/components/DateRangeInput

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

Code

How Astryx Date Range Input is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

'use client';

/* Copyright (c) 2026 Meta Platforms, Inc. See MIT notice in astryx-date-range-input.tsx. */

import '@/components/ui/astryx-date-range-input-utils/astryx-preview.css';
import {useState} from 'react';
import {DateRangeInput} from '@/components/ui/astryx-date-range-input';
import type {DateRange} from '@/components/ui/astryx-date-range-input';
import type {ISODateString} from '@astryxdesign/core/Calendar';
import {Stack} from '@astryxdesign/core/Layout';

function daysAgo(n: number): ISODateString {
  const d = new Date();
  d.setDate(d.getDate() - n);
  return d.toISOString().slice(0, 10) as ISODateString;
}

function today(): ISODateString {
  return new Date().toISOString().slice(0, 10) as ISODateString;
}

const presets = [
  {label: 'Last 7 days', getRange: () => ({start: daysAgo(7), end: today()})},
  {label: 'Last 30 days', getRange: () => ({start: daysAgo(30), end: today()})},
];

function DateRangeInputShowcase() {
  const [range, setRange] = useState<DateRange | null>(null);

  return (
    <Stack direction="vertical" width="100%" style={{maxWidth: 400}}>
      <DateRangeInput
        label="Date range"
        value={range}
        onChange={setRange}
        presets={presets}
      />
    </Stack>
  );
}

export default function Demo() {
  return (
    <div className="astryx-demo" data-astryx-theme="neutral" data-theme="light">
      <div className="astryx-demo-content" style={{maxWidth: 400}}>
        <DateRangeInputShowcase />
      </div>
    </div>
  );
}

Dependencies

More by Astryx

View all
  • Astryx Banner

    Astryx Banner

    61
  • Astryx Avatar

    Astryx Avatar

    34
  • Astryx Aspect Ratio

    Astryx Aspect Ratio

    32
  • Astryx Badge

    Astryx Badge

    30
  • Astryx Button Group

    Astryx Button Group

    29
  • Astryx Chat Composer Drawer

    Astryx Chat Composer Drawer

    27
  • Astryx Toggle Button

    Astryx Toggle Button

    17
  • Astryx Chat Tokenized Text

    Astryx Chat Tokenized Text

    10