Esc

Components

All components Every component, with search. Accordion Sections that expand and collapse, one at a time or several. Alert A highlighted message, optionally dismissible. Avatar A person's picture, with initials when there is none. Avatar group Overlapping avatars with a "+N" count for the rest. Badge A small status label. Banner A dismissible strip across the top of a page. Breadcrumb The path to the current page, collapsing long trails. Button Buttons in every variant and size, with icons and a loading state. Button to A button that submits a one-off form, like Rails' button_to. Card A bordered container with header, content and footer. Checkbox A checkbox with label, standalone or bound to a form builder. Collapsible A section that opens and closes under its trigger, like a branch of a nav tree. Data grid A sortable, filterable, server-paged table on AG Grid. Date picker A typed date field with a calendar, on Cally. Dialog A modal dialog on the native <dialog> element. Divider A horizontal or vertical rule, optionally labelled. Form field A label, hint and error message wired to any form control. Icon A Lucide icon. Image An image with consistent sizing and corner radius. Input A text field with label, hint and error message, standalone or with a form builder. Input group A text field with addons before or after it. Label A form label with a required marker. Link A link styled as text or as a button. Menu A dropdown menu with keyboard navigation. Pagination Page links for a long list, from a Pagy object. Password input A password field with a show/hide toggle. Popover Floating content anchored to a trigger. Radio group A set of radio buttons. Native select The browser's own select, styled closed; best for phones' system pickers. Select A styled dropdown with keyboard navigation and type-ahead, posting like a native select. Sheet A panel that slides in from an edge of the screen. Sidebar A collapsible application sidebar with groups and menus. Spinner A loading indicator. Switch An on/off toggle. Table A styled table with header, rows and caption. Table of contents An "On this page" list that follows the reader's scroll. Tabs Tabbed panels with keyboard navigation. Text Body text in set sizes, weights and tones. Textarea A multi-line text field with label, hint and error, that can grow with its text. Theme toggle A light/dark/system theme switcher. Tooltip A hint shown on hover and focus. Typography Headings, lead, muted, code and blockquote text styles.

Date picker

UI::DatePicker

A typed date field with a calendar, on Cally.

bin/rails generate velvetkit:add date_picker
Stimulus
ui--date-picker
Installs
cally

Examples

Default

Type the date as DD/MM/YYYY, or use the calendar

States

Type the date as DD/MM/YYYY, or use the calendar

Type the date as DD/MM/YYYY, or use the calendar

Type the date as DD/MM/YYYY, or use the calendar

Type the date as DD/MM/YYYY, or use the calendar

API

Arguments
UI::DatePicker.new(name: nil, value: nil, form: nil, field: nil, label: nil, required: false, error: nil, disabled: false, hint: true, min: nil, max: nil, class: nil, **html_attrs)

Notes

UI::DatePicker — a typed date field with a calendar beside it. Three inputs in one: what the user types (DD/MM/YYYY), what the form submits (ISO, hidden), and the calendar. The typed field comes first because people who know the date type it in a second: reaching a date years away in a calendar means clicking back month after month. The written format is not decided here. It comes from `date.formats.typed` in the locale, and this component derives the placeholder, the parse order and the separator from that one string — so a locale that writes dates differently changes what the field accepts, what it shows and what the hint says, together, with nothing hardcoded. The shipped English format is day-first; change `date.formats.typed` for month-first. A native date input follows the browser's locale instead, which is how the same form reads MM/DD on one machine and DD/MM on another, and how the 2nd of May gets recorded as the 5th of February. Cally is ~9 KB gzipped and loaded only when the calendar is first opened, so a form nobody opens a calendar on downloads nothing. Usage: <%= render(UI::DatePicker.new(form: f, field: :starts_on, required: true)) %> <%= render(UI::DatePicker.new(name: "event[date]", value: @date, label: "Date")) %>