Kinetik UI

Moon Phases

.md

The moon this week: discs pop in around tonight's, which swells in the middle with a soft halo.

v1.0.0Live on web@shopify/react-native-skiareact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add moon-phases

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/moon-phases.json

Install manually

  1. Install dependencies
    npx expo install @shopify/react-native-skia react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/moon-phases.tsx
    View source files

Usage

import { MoonPhases } from '@/components/kinetik/moon-phases';

<MoonPhases phase={0.57} />;

When to use

  • Weather, tide, night sky and outdoors apps.
  • Calendars that follow the lunar month.

When not to use

  • Astronomy that needs precision: the phase is yours to compute, and the row is a picture.

Notes

  • phase runs 0–1: 0 is new moon and 0.5 is full moon.
  • Waxing moons are lit on the right, as seen from the northern hemisphere.

Props

MoonPhasesProps

PropTypeDefaultDescription
phaserequirednumber—Position in the lunar cycle, 0–1: 0 is new moon, 0.5 is full moon.
titlestring—Heading. Defaults to the phase's name, e.g. "Waning Gibbous".
captionstring—Line under the moons. Defaults to the days until the next full moon.
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
One Skia canvas with prebuilt paths. Discs scale on UI-thread springs on arrival and on change. Nothing animates at rest.
Measured

Huawei P20 Lite (ANE-LX1), Android 9, release build · 10 ms median frame, 14 ms p90 · no frames drawn at rest · 120 MB app memory

Accessibility

Reduced motion
Discs appear in place, tonight does not bounce and the percentage does not count.
Screen readers
One label ("Waning Gibbous, 95% lit. Next full moon in 27 days").
Touch target
Not interactive.

Source files

components/kinetik/moon-phases.tsx is in the Code tab of the preview above.