<section class="cap-dictionary-entry" aria-label="Dictionary entry: Almanac" data-cap="dictionary-entry">
<p class="cap-dictionary-entry-head">
<dfn class="cap-dictionary-entry-word"><span class="cap-sr-only">almanac</span><span aria-hidden="true">al·ma·nac</span></dfn>
<span class="cap-dictionary-entry-pron">
<span class="cap-dictionary-entry-ipa">/ˈɔːl.mə.næk/</span>
<span class="cap-dictionary-entry-respell">AWL-muh-nak</span>
<a class="cap-dictionary-entry-listen" href="/audio/almanac.mp3" data-cap-part="listen-link" aria-label="Listen to the pronunciation of Almanac"><svg aria-hidden="true">…</svg></a>
<button type="button" class="cap-dictionary-entry-listen" data-cap-part="listen" data-src="/audio/almanac.mp3" aria-label="Listen to the pronunciation of Almanac" aria-pressed="false" hidden><svg aria-hidden="true">…</svg></button>
</span>
</p>
<p class="cap-dictionary-entry-pos"><i>noun</i>; plural <i>almanacs</i></p>
<ol class="cap-dictionary-entry-senses">
<li>A yearly book of the calendar.</li>
<li><i class="cap-dictionary-entry-label">publishing.</i> A yearly collection of facts on one subject.</li>
</ol>
<p class="cap-dictionary-entry-ety"><span class="cap-dictionary-entry-ety-label">Etymology</span> From Medieval Latin <i lang="la">almanach</i>.</p>
</section>
import { DictionaryEntry } from "capsomer/react/dictionary-entry";
<DictionaryEntry
term="Almanac"
syllables="al·ma·nac"
ipa="/ˈɔːl.mə.næk/"
respelling="AWL-muh-nak"
partOfSpeech="noun"
plural={["almanacs"]}
senses={[{ text: "A yearly book of the calendar." }, { label: "publishing", text: "A yearly collection of facts on one subject." }]}
etymology={["From Medieval Latin ", ["la", "almanach"], "."]}
audio="/audio/almanac.mp3"
/>
<section class="cap-dictionary-entry" id="de-link" aria-label="Dictionary entry: Ledger">
<p class="cap-dictionary-entry-head">
<dfn class="cap-dictionary-entry-word"><span class="cap-sr-only">ledger</span><span aria-hidden="true">led·ger</span></dfn>
<span class="cap-dictionary-entry-pron">
<span class="cap-dictionary-entry-ipa">/ˈlɛdʒ.ər/</span>
<span class="cap-dictionary-entry-respell">LEJ-er</span>
<a class="cap-dictionary-entry-listen" href="./missing-clip.mp3" data-cap-part="listen-link" aria-label="Listen to the pronunciation of Ledger">
<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M4 9.5h3.5L12 5.5v13l-4.5-4H4z" fill="currentColor" /><path class="cap-dictionary-entry-wave" d="M15 9.2a4 4 0 0 1 0 5.6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" /><path class="cap-dictionary-entry-wave" d="M17.6 6.6a7.6 7.6 0 0 1 0 10.8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" /></svg>
</a>
</span>
</p>
<p class="cap-dictionary-entry-pos"><i>noun</i></p>
<ol class="cap-dictionary-entry-senses">
<li>A book in which the accounts of a business are kept.</li>
</ol>
</section>
No clip, no etymology
<section class="cap-dictionary-entry" id="de-plain" aria-label="Dictionary entry: Lantern">
<p class="cap-dictionary-entry-head">
<dfn class="cap-dictionary-entry-word">Lantern</dfn>
<span class="cap-dictionary-entry-pron"><span class="cap-dictionary-entry-ipa">/ˈlæn.tərn/</span></span>
</p>
<p class="cap-dictionary-entry-pos"><i>noun</i></p>
<ol class="cap-dictionary-entry-senses">
<li>A lamp in a case that shields its flame from the wind.</li>
</ol>
</section>
API reference
SpeakerIcon
DictionaryEntry
Prop
Type
Required
Does
term
string
Yes
The word as it is spelled ("Almanac"); read by screen readers in lowercase.
syllables
string
The headword as it is shown, with its syllable dots ("al·ma·nac"); hidden from screen readers.
ipa
string
respelling
string
partOfSpeech
string
Yes
plural
string[] | null
senses
DictionarySense[]
Yes
etymology
EtymologyPart[]
audio
string
The clip. Without it there is no speaker.
listen
string
The speaker's name. Default: "Listen to the pronunciation of {term}".
Functions
Function
Signature
Does
listenLabel
(term: string): string
The dictionary entry's speaker. The server renders a plain link to the clip, which any browser plays with script off; this swaps in the button, which plays the clip in place on click, Enter or Space (a native button gives all three). Nothing plays until asked and the clip is fetched on the first press, not before. aria-pressed carries the state while it plays; a second press stops it. A clip that cannot load or play brings the link back, so the reader still has a way to hear it. The speaker's name: what it does and for which word.
Wires one speaker pair: button (hidden in the markup, data-src the clip) and link (the no-script link). Shows the button, hides the link, and returns a function that detaches.
enhance
(root?: Element | Document | DocumentFragment): () => void
Attaches to every [data-cap="dictionary-entry"] under root not yet attached. Returns a function that detaches. The root is Element | Document | DocumentFragment, not ParentNode: under @cloudflare/workers-types an HTMLFormElement does not type as a ParentNode, so a site could not pass its form.
Parts and data attributes
Class
Is
.cap-dictionary-entry
the root
.cap-dictionary-entry-ety
a part
.cap-dictionary-entry-ety-label
a part
.cap-dictionary-entry-head
a part
.cap-dictionary-entry-ipa
a part
.cap-dictionary-entry-label
a part
.cap-dictionary-entry-listen
a part
.cap-dictionary-entry-pos
a part
.cap-dictionary-entry-pron
a part
.cap-dictionary-entry-respell
a part
.cap-dictionary-entry-senses
a part
.cap-dictionary-entry-wave
a part
.cap-dictionary-entry-word
a part
State
Read from
:focus-visible
the platform
:hover
the platform
[aria-pressed="true"]
an attribute
[hidden]
an attribute
Accessibility
Key
Does
Tab
Reaches the speaker
Enter or Space on the speaker
Plays the clip; again stops it
Enter on the speaker link (no script)
Opens the clip
The speaker is named "Listen to the pronunciation of {term}" (listenLabel), its icon aria-hidden; as a button it is a toggle (aria-pressed).
Foreign words in the etymology carry their lang, so a screen reader pronounces them in their language.
The speaker's hit area is at least --target and --control; under forced colors a playing speaker keeps a heavier edge in Highlight, since its fill is gone.
Screen readers: no manual NVDA or VoiceOver run, by decision (2026-11-07); the automated browser checks and a front-end review stand in. Automated: see the site's Tests page.