Repeat rule editor (RRULE) that explains itself: a plain sentence and a rail of the next occurrences, spaced by time, with the end as a wall.
Press mePress me
Weekly status report · Schedule
Project Lumen · PDF to 4 recipients
Next: 2 Nov, 9 Nov, 16 Nov, 23 Nov, 30 Nov. 12 times
recurrence-picker, lively
Use it wherever something repeats: recurring tasks and events, shifts, scheduled exports and reports, send schedules, recurring invoices. A row of selects never says what the rule means or when it will fire; this editor keeps the rule as a sentence ("Every 2 weeks on Monday and Thursday, 12 times") and draws its next occurrences on a rail while you edit: one ball per date on a single line, spaced by time, so "every week" and "every 2 weeks" look different at a glance; a wall after the last ball where the rule ends, or the line fading out when it goes on. It edits an RFC 5545 RRULE subset (daily, weekly, monthly, yearly; interval; weekdays; day of the month or "second Tuesday"; until or count). For a single date use the date picker; for hours and minutes, the time picker.
The motion follows the three beats. Pressing a weekday ball charges it: the ball stretches up under the finger and a seed of its fill appears, and the rail's balls sink 1 px together while the wall's label pinches. On release a primary ball grows from its centre to the rim on the small spring and gives the rim one small kiss; the letter turns primary-foreground once the fill is wider than it. The sentence's pill makes room on the reflow spring: words that stay slide over, a word that changes crossfades in its own slot (the old one stays where it was until the new one has arrived, so every frame reads as a sentence), and numbers roll. New occurrences hop onto the rail from 6 px above, one stagger step apart from the first date forward, and squash flat as they land; the ones that leave drop 6 px and fade; the ones that stay slide to their new place when the window rescales (the rail always shows the next 12, so weekly spans about three months, monthly a year), and the tick labels crossfade. The wall slides to the last ball, which nudges it 2 px when it lands. Changing the frequency stretches the pill to its new option and cascades the weekday row in from below. calm grows the fill without the kiss and keeps every move short; the landing squash is amplified on the 10 px balls so it still reads.
pnpm dlx shadcn@latest add @motionkit-pro/recurrence-pickernpx shadcn@latest add @motionkit-pro/recurrence-pickeryarn dlx shadcn@latest add @motionkit-pro/recurrence-pickerbunx --bun shadcn@latest add @motionkit-pro/recurrence-pickerRequires a Pro license and the @motionkit-pro registry with your token. See Installation.
import { RecurrencePicker, toRRule, type RecurrenceRule } from "@/components/ui/recurrence-picker"
export function ReportSchedule() {
const [rule, setRule] = useState<RecurrenceRule | null>({
freq: "weekly",
interval: 1,
byDay: ["mo"],
count: 12,
})
return (
<form action={save}>
<RecurrencePicker start={new Date(2026, 10, 2)} value={rule} onValueChange={setRule} />
<input type="hidden" name="rrule" value={rule ? toRRule(rule) : ""} />
</form>
)
}value is a plain object (null = does not repeat). The helpers work without the component:
toRRule(rule) gives FREQ=WEEKLY;INTERVAL=2;BYDAY=MO,TH;COUNT=12 (floating local time: DTSTART and the time zone are yours to store).fromRRule(text) parses that subset back (with or without RRULE:), or returns null.occurrences(rule, start, { limit, from, to, weekStartsOn }) expands up to limit dates (60 by default).onOccurrencesChange(dates) hands you the dates whenever they change (every date of a rule that ends, up to 1000; the next 60 otherwise; [start] for "Does not repeat"), so the product can say what the rule means for it: "12 reports, last on Thu 10 Dec", "12 invoices, €5,760".Keep the RRULE out of product UI: it is for your database and calendar feeds, the sentence and the rail are for people.
describe(rule, { start, locale, labels }) returns the sentence.Pass start (the first occurrence): it anchors the rail, the default weekday and the monthly day, and keeps server and client rendering the same. Pick a layout with preset: card (the full editor in a 16 px tile, for a task or schedule dialog), popover (a 36 px "Repeats" row that grows into the card, for an event dialog) or sentence (every term is a pill that opens its own small editor, for one row in an automation or billing form). labels translates every fragment of the sentence and every control name; locale and weekStartsOn set the weekday and month names and the first column. frequencies limits the options, minInterval and maxCount set the error bounds. Set the motion character with temperament or MotionKitProvider.
preview picks what shows the dates: "rail" (the default, under the sentence), "month" or true (the mini month of earlier versions, beside the ends), a number of months, or false. Before this version the default was the mini month: pass preview="month" to keep it.
For your own layout, pass children and use the parts: RecurrencePicker.Summary, RecurrencePicker.Rail (occurrences, default 12), RecurrencePicker.Weekdays and RecurrencePicker.Preview read the root's rule.
Prop
Type
Also accepts all props of ComponentProps<"div">.
Prop
Type
Also accepts all props of Omit<
ComponentProps<"div">,
"defaultValue" | "onChange" | "children"
>.
The preview above: a "Weekly status report · Schedule" panel. At rest it reads in three lines: the sentence, the rail (every Monday for twelve weeks, the wall after the 12th) and what that means for the report (how many, the first, the last). On first view Thursday's ball is pressed and fills, Thursdays hop onto the rail between the Mondays and the wall slides in to six weeks; then the interval steps to 2, every other pair drops off and the rest spread back out. The numbers under the editor come from onOccurrencesChange. "Replay" plays it again.
A "Repeats" row in a new-event dialog: the trigger carries the short form ("Weekly on Tue, Thu") and grows out of itself into the editor, the editor clipped inside the growing surface; Escape or a click outside shrinks it back into the row and returns focus to it.
Press mePress me
New event
Design review · Room 2B
recurrence-picker, lively
"Bill every 1 month on day 1, 12 times": each term is a pill that opens its stepper, its frequency list, its day choice or its end, with no rail. Under it, the money consequence: how many invoices, their total and the last date, derived from onOccurrencesChange.
Press mePress me
Recurring invoice
Fernhill Bakery · Support plan
recurrence-picker, lively
role="group" named by aria-label (default "Repeat rule").aria-hidden, the state is aria-checked.role="group" "Repeat on" of <button aria-pressed> with the full weekday name as an sr-only label; the letter is aria-hidden. One tab stop, arrows move, Space toggles; the last selected day cannot be removed.role="spinbutton" fields with aria-valuenow, min and max; a value outside the bounds takes the destructive rim on blur and a role="alert" line under the card. An end date before start shows the same line and the rail shows no balls; the line and its alert go away as soon as the rule no longer has that end (another end, or "Once").field preset): the date reads in the summary's format ("2 Jan 2027"), typed dates follow the locale's order, and days before start are disabled.aria-hidden; an sr-only line lists the next five dates and the end ("Next: 2 Nov, 5 Nov, 16 Nov, 19 Nov, 30 Nov. 12 times"). The balls are not controls: nothing on the rail takes focus.popover: the trigger has aria-haspopup="dialog" and aria-expanded; focus moves into the editor and comes back to the trigger the moment it closes.foreground, filled ones primary-foreground; disabled keeps full text contrast.| Key | Action |
|---|---|
Tab / Shift + Tab | Frequency, interval, weekday balls (one tab stop), ends and their field |
ArrowLeft / ArrowRight | Frequency: previous / next option. Weekdays: previous / next ball |
Home / End | Weekdays: first / last ball. Interval and count: lowest / highest value |
Space / Enter | Toggles the focused weekday; opens the popover trigger or a sentence term |
ArrowUp / ArrowDown | Interval and count: steps the number. Ends: previous / next option |
Escape | Closes the popover or a term's editor, focus back on its trigger |
With reduced motion (the OS setting, or MotionKitProvider reducedMotion="always") nothing stretches, kisses, sinks or hops. A weekday fill crossfades in place, the rail's balls crossfade where they land and the wall glides without the nudge, new words of the sentence crossfade where they land without sliding, numbers crossfade, the frequency pill and the end ball glide, all in the 120 ms fade. The popover crossfades in place. Every state is as complete as with motion.
transform and opacity. The sentence's pill is one absolutely positioned element whose width and height follow the measured text (measured once per change, never in a frame loop); words are moved by hand-made FLIP on transform.transform percentages of the track, so the rail is responsive without measuring; only the tick labels read the track's width (from a ResizeObserver) to leave out the ones that would touch.occurrences is a bounded expansion (13 dates for the rail, up to 1000 for onOccurrencesChange) inside useMemo. It is not a full RRULE engine: no BYHOUR, BYWEEKNO, EXDATE or RDATE.date-picker item (a registry dependency, with react-day-picker); it mounts only while "On" is picked.ResizeObserver.motion, @radix-ui/react-popover and @radix-ui/react-radio-group (shared with the popover and radio group items).Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Not measured yet · budget 27.5 kB gzip
Component and MotionKit helpers; excludes react, react-dom, @radix-ui/react-popover, @radix-ui/react-radio-group, motion.
press, a value change, click
No stretch, kiss, sink or hop: weekday fills, rail balls and changed words crossfade in place, the wall glides without the nudge, the pills and the end ball glide in the 120ms fade.
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)