Date
A date people can read, with the machine-readable value in datetime, formatted at build time.
Native .astro · no React · MIT · free, no account
Updated
Install
npx shadcn@latest add https://www.themes.dev/astro/r/time.jsonThe CLI needs a components.json (from npx shadcn init), which also writes the tokens these files use. No CLI? Copy the files below to the same paths.
Files
---// A date people can read, with the machine-readable value in datetime: <Time date={post.data.date} />.// Formatted at build time with Intl, in the language you pass (default en-GB: 23 November 2026).interface Props { date: Date | string; locale?: string; format?: Intl.DateTimeFormatOptions; class?: string;}const { locale = 'en-GB', format = { day: 'numeric', month: 'long', year: 'numeric' }, class: className } = Astro.props;const date = new Date(Astro.props.date);--- <time datetime={date.toISOString().slice(0, 10)} class={className}>{new Intl.DateTimeFormat(locale, { ...format, timeZone: 'UTC' }).format(date)}</time>More for content
- FigureFreeAn image with a caption. Width, height and alt are required, so the page never jumps; local images go through astro:assets.Figure.astro
- ProseFreeLong-form text in a 65-character measure on shadcn's tokens: headings, lists, quotes, tables, code and images, light and dark.Prose.astro · prose.css
- Code blockFreeCode highlighted at build time with Shiki, light and dark, with a file name and a copy button.CodeBlock.astro