Astryx

Astryx Date Time Input

Component

About

DateTimeInput combines date and time selection in one field. With presentation="adaptive-native" (the default), mouse/trackpad devices use Astryx typed fields and popovers, while coarse-pointer devices use browser/OS date and time controls in the same two-segment field. presentation="native" uses both native controls on every pointer; presentation="adaptive-bottom-sheet" keeps Astryx's own surfaces — pointer fields on fine pointers and the coordinated Date/Time bottom sheet on coarse pointers; "popover" and "bottom-sheet" force one Astryx surface on every pointer. The closed segments stay side by side when at least 400px is available and wrap into full-width rows below 400px, independent of viewport width. Use it for scheduling, event creation, deadline setting, or any form field that needs a specific datetime. Astryx by Meta. Source: https://astryx.atmeta.com/components/DateTimeInput

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

Code

How Astryx Date Time 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 the MIT notice in astryx-date-time-input.tsx. */

import '@/components/ui/astryx-date-time-input-utils/astryx-preview.css';
import '@astryxdesign/theme-neutral/fonts.css';
import {useSyncExternalStore} from 'react';
import {Theme} from '@astryxdesign/core/theme';
import {neutralTheme} from '@astryxdesign/theme-neutral/built';

import {useState} from 'react';
import {DateTimeInput} from '@/components/ui/astryx-date-time-input';
import type {ISODateTimeString} from '@/components/ui/astryx-date-time-input';
import {Stack} from '@astryxdesign/core/Layout';

function OfficialSample() {
  const [dateTime, setDateTime] = useState<ISODateTimeString | undefined>(
    undefined,
  );

  return (
    <Stack
      direction="vertical"
      width="100%"
      style={{minWidth: 0, maxWidth: 400, marginBlockEnd: 'max(0px, calc(700px - 100dvh))'}}>
      <DateTimeInput
        label="Meeting time"
        placeholder="Select a date"
        value={dateTime}
        onChange={setDateTime}
        hasClear
      />
    </Stack>
  );
}

function readPreviewMode() {
  const {classList} = document.documentElement;
  return classList.contains('dark') ? 'dark' : 'light';
}

function subscribeToPreviewMode(callback: () => void) {
  const observer = new MutationObserver(callback);
  observer.observe(document.documentElement, {attributes: true, attributeFilter: ['class']});
  return () => observer.disconnect();
}

export default function Demo() {
  const mode = useSyncExternalStore(subscribeToPreviewMode, readPreviewMode, () => 'light' as const);
  return (
    <Theme theme={neutralTheme} mode={mode}>
      <div className="astryx-demo">
        <div className="astryx-demo-content" data-centered style={{maxWidth: 400}}>
          <OfficialSample />
        </div>
      </div>
    </Theme>
  );
}

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

    11