Render the Mushaf in your web app and interact with everything on the page: words, ayahs, surahs and more.
Pages look exactly like the printed Mushaf, in the browser.
Click a word, an ayah, a surah or a juz marker and get its details.
Colour anything on the page, from one word to a whole range.
Let users pick a range by tapping where it starts and ends.
1. Install
npm install mushaf.js2. Add a container
<link rel="stylesheet" href="node_modules/mushaf.js/dist/mushaf.min.css" />
<div id="mushaf"></div>3. Render a page
import { Mushaf } from 'mushaf.js'
const mushaf = new Mushaf({
container: '#mushaf',
onWordClick: (word) => mushaf.highlightWord(word.surah, word.ayah, word.word),
})
await mushaf.init()
await mushaf.renderPage(1)That's it. Page data and fonts come from cdn.mushafjs.com, so there is nothing to host. Read the guide →
Paint a student’s progress on the page: memorized, review and homework ranges, plus the exact words they slipped on.
highlightRange · batchHighlights · style: colorOpen demo →A teacher taps a first and a last word to hand out the next lesson. Store it as two integers and draw it anywhere.
startSelection · onSelectionChange · wordPositionOpen demo →Move a cursor through the page word by word, the way an audio player would, and let readers tap to jump.
highlightWord · highlightAyah · keysOpen demo →Tap an ayah to bookmark it with a colour tag. Highlights follow the reader across pages; the list jumps back.
onAyahClick · goToAyah · clearHighlight(key)Open demo →