Widget Documentation

Everything you need to embed ModernAstro widgets on your website.

Quick Start

1

Get your API key

Register with your email and website URL. Your key is generated instantly.

2

Add the script tag

Paste this into your HTML where you want the widget:

<div id="my-widget"></div>
<script src="https://cdn.modernastro.com/widgets/v1/loader.js"
  data-key="YOUR_API_KEY"
  data-widget="panchang"
  data-target="my-widget"
  data-location="28.6139,77.2090"
  async></script>
3

Done!

The widget renders inside Shadow DOM — no CSS conflicts with your site. Customize with data attributes.

Data Attributes

Attribute Required Description
data-keyYesYour API key (pk_live_...)
data-widgetYesWidget type: panchang, choghadiya, nakshatra, kundli, numerology, compatibility
data-targetNoCSS selector or ID of container element
data-themeNolight (default), dark, or auto
data-accentNosaffron (default), celestial, emerald, purple
data-langNoen (default) or hi
data-sizeNocompact, standard (default), or wide
data-locationAuto-load onlyCoordinates as lat,lon (e.g., 28.6139,77.2090)
data-location-nameNoDisplay name for the location

Widget Catalog

Panchang

data-widget="panchang"
Auto-load

Shows today's Tithi, Nakshatra, Yoga, Karana, Sunrise/Sunset, and Rahu Kaal. Requires data-location.

API params: coordinates, date, language, locationName

Choghadiya

data-widget="choghadiya"
Auto-load

Day and night muhurat periods (8 each) with quality indicators. Current period highlighted. Requires data-location.

API params: coordinates, date, language, locationName

Nakshatra Finder

data-widget="nakshatra"
Interactive

User enters birth date, time, and place. Returns nakshatra, pada, lord, moon sign, and lucky syllables.

API params: datetime, coordinates, language

Kundli Summary

data-widget="kundli"
Interactive

User enters birth details. Returns ascendant, sun sign, moon sign, nakshatra, and current Mahadasha/Antardasha.

API params: datetime, coordinates, language

Numerology Calculator

data-widget="numerology"
Interactive

User enters full name and DOB. Returns Life Path, Expression, and Soul Urge numbers with meanings.

API params: name, date

Compatibility Checker

data-widget="compatibility"
Interactive

Two-person form. Returns Guna Milan score (out of 36), verdict, and top 3 matching aspects.

API params: datetimeA, coordinatesA, datetimeB, coordinatesB

Platform Examples

WordPress

Add a Custom HTML block in the Gutenberg editor and paste the embed code.

Works with any theme. No plugin needed.

React / Next.js

Use a useEffect hook to load the script dynamically, or use next/script.

Shadow DOM prevents style conflicts with CSS-in-JS.

Wix / Squarespace

Use the "Embed" or "Custom Code" element to paste the script tag.

Works in both drag-and-drop builders.

Plain HTML

Just paste the embed code anywhere in your HTML file. No build step required.

The async attribute ensures non-blocking load.

Rate Limits

Tier Daily Limit Per Minute Domains
Free1,000305
Growth10,00010020
Business100,00050050

Need higher limits? Contact us for Growth or Business plans.