PhiaUi.Components.DateCard (phia_ui v0.1.17)

Copy Markdown View Source

DateCard component — a single selectable day card showing the day number and short weekday abbreviation.

Visual states

StateAppearance
:defaultWhite/bg background, border, shadow-sm
:todaySoft primary tint (bg-primary/10 text-primary border-primary/20)
:selectedSolid primary fill (bg-primary text-primary-foreground)
:disabledMuted, opacity-50 pointer-events-none cursor-not-allowed

Sizes

SizeWidthHeightNumber textDay text
:smw-12h-16text-xltext-[10px]
:defaultw-16h-20text-2xltext-xs
:lgw-20h-24text-3xltext-sm

Examples

<%!-- Basic --%>
<.date_card date={~D[2026-03-23]} />

<%!-- Selected today --%>
<.date_card date={Date.utc_today()} selected today />

<%!-- Clickable --%>
<.date_card date={~D[2026-03-23]} on_click="select_date" />

<%!-- Disabled --%>
<.date_card date={~D[2026-03-23]} disabled />

Summary

Functions

Renders a selectable day card with day number and short weekday abbreviation.

Functions

date_card(assigns)

Renders a selectable day card with day number and short weekday abbreviation.

Examples

<.date_card date={~D[2026-03-23]} />
<.date_card date={~D[2026-03-23]} selected />
<.date_card date={~D[2026-03-23]} today />
<.date_card date={~D[2026-03-23]} disabled />
<.date_card date={~D[2026-03-23]} on_click="select_date" />

Attributes

  • date (:any) (required) - Date.t() to display.
  • selected (:boolean) - Whether this card is selected. Defaults to false.
  • today (:boolean) - Whether this date is today. Defaults to false.
  • disabled (:boolean) - Whether this card is disabled. Defaults to false.
  • on_click (:string) - phx-click event name (ignored when disabled). Defaults to nil.
  • size (:atom) - Card size variant. Defaults to :default. Must be one of :sm, :default, or :lg.
  • class (:string) - Additional CSS classes merged via cn/1. Defaults to nil.
  • Global attributes are accepted. HTML attributes forwarded to the root div.