Pure TailwindMIT licensed

Tailwind Native Date Input

A styled type="date" that keeps every native affordance — keyboard entry, locale, min/max, the OS calendar — while the closed field matches your form. scheme-dark and accent-* are both real v4 utilities, which is most of the work.

Live Demo
Plain CSSTailwind v4
Try it

Untitled UI Pro: 5,000+ React + Tailwind CSS v4 components · from $349 one-time

Untitled UI React · Affiliate link

Get Untitled UI Pro

The code

<div class="tif-17 grid min-h-svh w-full place-items-center bg-tif17-bg px-6 py-14 font-tif17-sans" aria-label="Native date input demo">
  <label class="grid w-full max-w-70 gap-1.5">
    <span class="font-tif17-mono text-[10px] tracking-[0.12em] text-tif17-mut uppercase">Start date</span>
    <input type="date" name="tif17-start"
      class="w-full scheme-dark rounded-[10px] border border-white/12 bg-tif17-field px-3.5 py-3 text-sm font-medium text-tif17-ink accent-tif17-acc outline-none transition-[border-color,background-color] duration-200 focus:border-tif17-acc focus:bg-tif17-field2 [&::-webkit-calendar-picker-indicator]:cursor-pointer [&::-webkit-calendar-picker-indicator]:opacity-80 [&::-webkit-calendar-picker-indicator]:[filter:invert(0.7)_sepia(1)_saturate(5)_hue-rotate(150deg)] [&::-webkit-calendar-picker-indicator:hover]:opacity-100">
  </label>
</div>
@import "tailwindcss";

@theme {
  --color-tif17-bg: #12121a;
  --color-tif17-bg: oklch(0.19 0.015 285);
  --color-tif17-field: #1a1a22;
  --color-tif17-field: oklch(0.23 0.015 285);
  --color-tif17-field2: #1f1f2a;
  --color-tif17-field2: oklch(0.26 0.018 285);
  --color-tif17-ink: #f0eeff;
  --color-tif17-ink: oklch(0.95 0.02 290);
  --color-tif17-mut: #b8b6d4;
  --color-tif17-mut: oklch(0.77 0.03 290);
  --color-tif17-acc: #06b6d4;
  --color-tif17-acc: oklch(0.72 0.13 205);
  --font-tif17-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-tif17-mono: 'JetBrains Mono', ui-monospace, monospace;
}

.tif-17 {
  width: 100%;
}

.tif-17 ::selection {
  background: var(--color-tif17-acc);
  color: #12121a;
}

Setup — do this once per project

Skip this if your project already runs Tailwind v4.

1Load Tailwind
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

Compiles in the browser — perfect for a CodePen or a quick test, not for production.

2Add the stylesheetRequiredthe @theme block is what makes the custom utilities exist
@import "tailwindcss";

@theme {
  --color-tif17-bg: #12121a;
  --color-tif17-bg: oklch(0.19 0.015 285);
  --color-tif17-field: #1a1a22;
  --color-tif17-field: oklch(0.23 0.015 285);
  --color-tif17-field2: #1f1f2a;
  --color-tif17-field2: oklch(0.26 0.018 285);
  --color-tif17-ink: #f0eeff;
  --color-tif17-ink: oklch(0.95 0.02 290);
  --color-tif17-mut: #b8b6d4;
  --color-tif17-mut: oklch(0.77 0.03 290);
  --color-tif17-acc: #06b6d4;
  --color-tif17-acc: oklch(0.72 0.13 205);
  --font-tif17-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-tif17-mono: 'JetBrains Mono', ui-monospace, monospace;
}

.tif-17 {
  width: 100%;
}

.tif-17 ::selection {
  background: var(--color-tif17-acc);
  color: #12121a;
}
3Fonts used by this demooptional — skip if you have your own type stack
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Plus+Jakarta+Sans:wght@400;500;600&display=swap">

What changed in the port

Which parts became utilities, which stayed CSS, and why.

  • color-scheme: dark becomes the scheme-dark utility, which is one of v4's quietly useful additions.
  • accent-tif17-acc was added — the CSS original lists it as a customisation, but tinting the selected day costs one class and improves the popover immediately.
  • The indicator filter stays a bracket selector with an arbitrary [filter:…]: Chromium-only, and honest about it.
Paste this into ChatGPT, Claude, Cursor, or any coding assistant. The block below is pre-framed with everything the AI needs to integrate this demo into your project — markup, styles, scoping notes, and the source URL. Hit Copy and paste straight into your chat.
Here's a working CSS demo from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Tailwind Native Date Input
Source: https://codefronts.com/components/tailwind-css-input-fields/tailwind-native-date-input/

A styled type="date" that keeps every native affordance — keyboard entry, locale, min/max, the OS calendar — while the closed field matches your form. scheme-dark and accent-* are both real v4 utilities, which is most of the work.
## HTML
```html
<div class="tif-17 grid min-h-svh w-full place-items-center bg-tif17-bg px-6 py-14 font-tif17-sans" aria-label="Native date input demo">
  <label class="grid w-full max-w-70 gap-1.5">
    <span class="font-tif17-mono text-[10px] tracking-[0.12em] text-tif17-mut uppercase">Start date</span>
    <input type="date" name="tif17-start"
      class="w-full scheme-dark rounded-[10px] border border-white/12 bg-tif17-field px-3.5 py-3 text-sm font-medium text-tif17-ink accent-tif17-acc outline-none transition-[border-color,background-color] duration-200 focus:border-tif17-acc focus:bg-tif17-field2 [&::-webkit-calendar-picker-indicator]:cursor-pointer [&::-webkit-calendar-picker-indicator]:opacity-80 [&::-webkit-calendar-picker-indicator]:[filter:invert(0.7)_sepia(1)_saturate(5)_hue-rotate(150deg)] [&::-webkit-calendar-picker-indicator:hover]:opacity-100">
  </label>
</div>
```
## CSS
```css
@import "tailwindcss";

@theme {
  --color-tif17-bg: #12121a;
  --color-tif17-bg: oklch(0.19 0.015 285);
  --color-tif17-field: #1a1a22;
  --color-tif17-field: oklch(0.23 0.015 285);
  --color-tif17-field2: #1f1f2a;
  --color-tif17-field2: oklch(0.26 0.018 285);
  --color-tif17-ink: #f0eeff;
  --color-tif17-ink: oklch(0.95 0.02 290);
  --color-tif17-mut: #b8b6d4;
  --color-tif17-mut: oklch(0.77 0.03 290);
  --color-tif17-acc: #06b6d4;
  --color-tif17-acc: oklch(0.72 0.13 205);
  --font-tif17-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-tif17-mono: 'JetBrains Mono', ui-monospace, monospace;
}

.tif-17 {
  width: 100%;
}

.tif-17 ::selection {
  background: var(--color-tif17-acc);
  color: #12121a;
}
```

How this works

Two utilities do what a stylesheet used to. scheme-dark emits color-scheme: dark and accent-* emits accent-color — between them the popover chrome and the selection chip stop looking like a different product:

class="scheme-dark accent-tif17-acc focus:border-tif17-acc"

The icon still needs a filter. ::-webkit-calendar-picker-indicator cannot be recoloured directly, so an invert/sepia/hue-rotate stack pushes it toward the accent. That is a hack, it is Chromium-only, and it stays a bracket selector rather than pretending to be a design token.

Make it yours

  • Hue: retune the hue-rotate in the indicator filter to match any accent.
  • Range: min and max attributes constrain bookings natively.
  • Chip: accent-tif17-acc is the one-line way to tint the calendar's selection.
  • Field: focus:border-* and focus:bg-* like every other demo here.

Gotchas — read before shipping

  • Safari's popover is essentially unrestylable. You are styling the closed field and accepting the OS for the rest.
  • ::-webkit-calendar-picker-indicator does not exist in Firefox — its icon is untargetable.
  • An empty date input shows mm/dd/yyyy per locale and no CSS can change that string.

Browser support

ChromeSafariFirefoxEdge
111+16.4+128+111+

The date input is universal; the picker-indicator pseudo is Chromium-only and degrades to the default icon.

Techniques used in this demo

Utilitiesfirst-class utility or variant

Theme tokensset in @theme, used by a utility

Search CodeFronts

Loading…