pastetaste
Lunar Widget
The moon for any date: phase computed from the date, shaded per pixel on a canvas with a real terminator, plus name, illumination and cycle ruler. Optional drag or keyboard scrubbing with a spring back to today.
Paste it into Claude Code: it installs the component, asks for your brand and content, and places it on the page you name.
Live demo. Move the mouse and scroll inside it.
Install
Or by hand, in a Next.js project with shadcn set up. It writes components/pastetaste/lunar-widget.tsx.
npx shadcn@latest add https://pastetaste.com/r/lunar-widget.jsonDependenciesmotion@^12.23.0widget-frame
Prompt
Install the pastetaste component "Lunar Widget" (lunar-widget) into this Next.js project and use it.
What it is: The moon for any date: phase computed from the date, shaded per pixel on a canvas with a real terminator, plus name, illumination and cycle ruler. Optional drag or keyboard scrubbing with a spring back to today.
Before you place it, ask me (one short message, in my language; "skip" = sensible default): which page and section it goes in, my brand colour (hex), the text, labels or images it should show, and whether I want my logo or my own copy in the demo content. Then:
Steps:
1. If the project has no components.json, run: npx shadcn@latest init -y -d. Then run: npx shadcn@latest add https://pastetaste.com/r/lunar-widget.json
(it writes components/pastetaste/lunar-widget.tsx and its pastetaste dependencies: widget-frame; install any npm packages it reports: motion@^12.23.0).
2. Import it: import { LunarWidget } from "@/components/pastetaste/lunar-widget" (check the file for the exact named export).
3. Put it where it fits on the page I name, keep the rest of the page untouched, and pass props for my colours instead of editing the installed file.
4. It does not depend on Tailwind; colours come from CSS variables (--pt-*) or props.
5. It supports prefers-reduced-motion with a still state; do not remove it.
Props (all optional unless the type has no default):
- date: Date | number | string = now — Date to show. Without it the widget reads the clock after mount and refreshes every ten minutes.
- size: '1x1' | '2x1' = '1x1' — 1x1 stacks moon and name; 2x1 adds a large percentage, the age and a 30-tick cycle ruler.
- scrub: boolean = false — Let the viewer drag the moon sideways or use arrow keys (±1 day), Page keys (±7), Home (today) to move through the days, up to 60 either way.
- caption: string = 'Moon phase' on 2x1 — Mono caption in the top row.
- hemisphere: 'north' | 'south' = 'north' — South turns the moon upside down, as seen from the southern hemisphere.
- tilt: number = 0 — Rotates the terminator axis in degrees.
- tone / accent: WidgetTone / string = 'dark' / token — Tile surface and the accent used by the cycle ruler.
- onDateChange: (date: Date) => void — Called when scrubbing changes the displayed date.
- moonPhase(date): (date) => MoonInfo — Named export: elongation, illumination, age, phase name and days to the next full and new moon, without any UI.
Live preview: https://pastetaste.com/c/lunar-widget
Then run the dev server, check it in the browser at desktop and mobile width, and tell me the page URL.Props 9
| Prop | Type | Default | Description |
|---|---|---|---|
| date | Date | number | string | now | Date to show. Without it the widget reads the clock after mount and refreshes every ten minutes. |
| size | '1x1' | '2x1' | '1x1' | 1x1 stacks moon and name; 2x1 adds a large percentage, the age and a 30-tick cycle ruler. |
| scrub | boolean | false | Let the viewer drag the moon sideways or use arrow keys (±1 day), Page keys (±7), Home (today) to move through the days, up to 60 either way. |
| caption | string | 'Moon phase' on 2x1 | Mono caption in the top row. |
| hemisphere | 'north' | 'south' | 'north' | South turns the moon upside down, as seen from the southern hemisphere. |
| tilt | number | 0 | Rotates the terminator axis in degrees. |
| tone / accent | WidgetTone / string | 'dark' / token | Tile surface and the accent used by the cycle ruler. |
| onDateChange | (date: Date) => void | - | Called when scrubbing changes the displayed date. |
| moonPhase(date) | (date) => MoonInfo | - | Named export: elongation, illumination, age, phase name and days to the next full and new moon, without any UI. |