Bible SDK

Preview

A unified Bible data SDK, with optional drop-in Scripture components for web pages.

A community project. Bible text from AO Lab's Free Use Bible API, with no API key. YouVersion, fetch.bible, and server-only API.Bible are optional adapters. Use the DOM-free data API on its own, or add the reference finder and web components.

Get Bible data Add browser components

Bible data SDK

Discover versions, books, and chapters, and retrieve Scripture with attribution and display guidance. The data SDK works in a browser, Node, or Bun without components, DOM access, CSS injection, or page-wide component defaults. API.Bible is server-only because its API key is private.

Import /data for async/await, or /data/effect for native Effect programs. Both use the same Effect v4 implementation, validation, errors, and caching. AO Lab is the default; choose a provider to use another source.

Install the package. You do not need to import or directly install Effect for async/await. Effect remains a transitive runtime dependency and contributes to bundle size.

The example returns John 3:16–18 as passage.text, with separate attribution and instructions. See the passage data reference for result fields and supported passage IDs.

Native Effect API

If your application uses Effect, install effect@^4 directly and import from /data/effect. Methods return lazy Effects with the same results and ScriptureError in the failure channel.

The same discovery and passage example, composed as one Effect program:

Use Effect.catchTag("ScriptureError", ...) for expected failures. Layers, RequestPolicy, and service-based scripture programs are exported from /data/effect, not /data. See Effect configuration and custom providers for composition and testing.

Verse of the day

Get a daily verse or short passage with the same attribution, licenses, source limitations, and display instructions as any other passage. Available in /data and /data/effect, including service-based scripture.getVerseOfTheDay() with a BibleSource Layer.

getVerseOfTheDay({ date?, versionId?, calendarSource? }) returns { date, calendarSource: { provider, sourceUrl }, passage }. calendarSource chooses the daily reference calendar, not the Bible text provider; it defaults to "provider", the selected provider's native calendar. The full ScripturePassage is in passage. Pass a real YYYY-MM-DD date, not a timestamp, or omit it for the runtime's local date when the operation executes. On a server, pass the reader's date explicitly if their timezone differs. Invalid dates fail with invalid_reference.

ProviderNative calendarDaily selection
AO LabSupportedIts SDK follows a shared, deterministic yearly order with Christian holidays, using an MIT-licensed reference dataset.
YouVersionSupportedIts calendar API accepts day 1-366, with no year parameter. The SDK accepts only dates in the runtime's current year, not historical or future-year lookups. This does not promise a published schedule for future days.
fetch.bibleNo native calendar documentedIts client API provides Bible text, not daily selections. Opt into the shared calendar.
API.BibleNo native calendar documentedIts daily-verse tutorial uses an app-owned reference list, not a calendar endpoint. Opt into the shared calendar with a data adapter.

Check scripture.capabilities.verseOfTheDay to label or disable a provider-calendar option: true for AO Lab and YouVersion, false for fetch.bible and API.Bible. This reports implementation, not credentials, translation availability, or rights. Without native support, the default call fails with unsupported and makes no calendar request. Existing custom providers remain compatible; an optional BibleDataProvider.getVerseOfTheDay(date) can return an Effect of { passageId, sourceUrl }.

Use the shared reference calendar

Opt in explicitly with any data provider. Only the reference comes from AO Lab; Scripture text still comes from your selected provider and version.

daily.calendarSource identifies the calendar separately from daily.passage.provider. This is AO Lab's selection, not another provider's own daily verse. There is no automatic fallback after authentication, network, or availability failures. Missing content fails with unavailable; the SDK never replaces the verse or translation. The reference list uses standard English/BSB numbering; cross-provider versification differences remain possible, not automatically mapped.

The list contains references, not Scripture text. Its MIT license does not grant translation rights. Follow each translation's license for fetch.bible and AO Lab. YouVersion still requires your public app key, publisher agreements, attribution, and applicable paid-app and AI-use conditions. API.Bible still requires your own server-side credentials, applicable plan and translation permissions, copyright display, FUMS web-display reporting, and refreshing cached content within 30 days. Passage instructions remain intact; no new persistent caching or offline rights are established. Verse art and devotional content are not included.

For the existing <bible-sdk-passage>, set passage-id to daily.passage.passageId and use the same provider and version. The data API does not register components or start an automatic midnight refresh; call it again when your app needs a new day's verse.

Choose a Bible provider

Use AO Lab by default, or select fetch.bible, YouVersion, or API.Bible. All four support the same data API; API.Bible runs only on your server. Each client uses one provider; it never substitutes a translation or falls back to another source.

ProviderSetupDefault version ID
AO LabNo API key. Default provider.BSB
fetch.bibleNo API key. Declare your usage.eng_bsb
YouVersionRequires a public app key.3034
API.BibleYour own private key and official SDK client, server-only.Explicitly choose an accessible edition.

API.Bible requires server-side setup

Keep your API.Bible key on your server. For browser components, use your app's backend or a compatible serverless function to fetch passages. You do not need a separate proxy service.

If your site only serves static files, add a server endpoint or choose AO Lab for a browser-only setup without an API key.

Version IDs belong to one provider: BSB, eng_bsb, and 3034 are not interchangeable. Review the selected translation's license before use. Free access and usage filters do not grant commercial, redistribution, or offline rights.

YouVersion has additional paid-app and AI-use conditions. Review the YouVersion requirements before using that adapter.

AO Lab: use the default

AO Lab preserves headings, poetry, and words-of-Jesus formatting in native HTML when supplied by the translation. Its license notice, or the translation name linked to the license, appears below the displayed text. To create a separate provider instance, import createAOLabProvider from @faith-tools/bible-sdk/providers/ao-lab.

Use aoLabProvider, createAOLabProvider(), and provider: "ao-lab" for new code. The old helloaoProvider, createHelloAOProvider(), /providers/helloao import path, and provider: "helloao" input remain supported as deprecated aliases. Daily-verse selection uses calendarSource: "ao-lab"; calendarSource: "helloao" is also a deprecated alias. Returned provider IDs (including event details and daily calendar provenance) remain helloao, and tracing identifiers and upstream URLs stay unchanged. This additive migration does not change the source or its data.

fetch.bible: declare your usage

Set usage.commercial to your application's actual use. The example declares noncommercial use. The derivatives, attributionless, and limitless filters default to false, false, and true. Filters are not legal permission; review each translation's terms. The adapter uses the official collection.

API.Bible: your own server-side client

Browser components use your server. Create an endpoint on your backend or a compatible serverless function. The component requests passages from that endpoint; only your server sends the private key to API.Bible. See the passage component example.

Install the official SDK alongside Bible SDK on a Node 20+ or Bun server. This adapter uses the node export condition; other server runtimes need Node-compatible package resolution:

Each application supplies its own registered API.Bible account/key and applicable licenses. Bible SDK supplies adapter code, not shared-account access. Keep the key in a server secret, never a browser bundle, VITE_* variable, element attribute, URL, or log. The adapter export rejects browser resolution and construction; that does not replace keeping secrets out of client code.

Set upstream maxAttempts: 1 so Effect owns retries and deadlines. Avoid SDK hooks/custom transports that log credentials or response bodies. Choose defaultVersionId from your account's listVersions() results. No edition is chosen automatically. Chapters exclude intro entries; plain text preserves scriptural superscriptions and poetry line breaks, not style-derived indentation, alignment, italics, or small caps. It omits editorial headings and notes. Numbering remains unknown. Incomplete endpoint coverage fails rather than silently claiming the whole range; upstream passages can be limited to 200 verses.

Application obligations: review the Terms, AUP and account agreements, and each translation's metadata. Returned instructions are guidance, not certification of compliance.

  • Display reporting: report reporting.token for each actual web view to FUMS, including cache hits, not fetches/prefetches. The host owns device/session IDs and privacy requirements. No analytics are sent automatically.
  • Attribution: show attribution and links below Scripture, identify the translation, and provide the required linked copyright/about page. Preserve publisher.copyrightHtml and publisher.infoHtml; sanitize this untrusted upstream HTML before rendering. Keep the visible API.Bible source link.
  • Caching and removal: discovery/publisher caches refresh after 14 days. Refresh downstream copies by cache.expiresAt (epoch milliseconds), never retain metadata/content over 30 days without refresh, and honor shorter removal/revocation deadlines. Some requests require removal within 24 hours; termination provisions can require immediate deletion. A TTL is not offline permission.
  • Plan and content restrictions: Starter is noncommercial even for public-domain editions. Each app owner accepts the required account agreements, including the Statement of Orthodoxy, and checks licenses, content integrity, territorial/export restrictions, and economic sanctions. Violations can lead to suspension/revocation, removal duties, audits, fees, and indemnification.
  • DRM and AI: the terms require application-level DRM restricting copying/distribution, printing over 100 verses, territory and device counts, without specifying a universally compliant implementation. A private key alone does not satisfy that obligation. Express Licensing guidance restricts copyrighted and Creative Commons Scripture in LLM prompts as well as training. Public-domain runtime prompts are permitted; confirm training, TTS, and exports separately.

API.Bible in the passage component

The same server provider implements getPassageDisplay(versionId, passageId). It requests native HTML once, validates coverage, sanitizes unsafe markup, and preserves USX classes for poetry, scriptural titles, small caps, italics, and tables. The component loads a reviewed, commit-pinned copy of the official Scripture Styles inside its shadow root. This CSS is optional under API.Bible's guidance, not a required design. Customize it with --scripture-*; theme, verse-number, heading, and direction controls still work. Omit red-letter to keep the official muted .wj styling, use red-letter="on" to color marked words of Jesus red, or use red-letter="off" for the text color. These controls require the translation to supply words-of-Jesus markers. Hiding editorial headings leaves scriptural Psalm titles visible.

Keep the provider on your server and expose safe displays through your own endpoint. Pass a browser provider to defineScripturePassage, not the server provider. There is no private-key attribute or built-in provider="api-bible" string option.

Add your app's authentication, rate limits, edition/access controls, and privacy-aware FUMS integration. This example does not create a public shared-key proxy. The translation picker can use the same browser provider through defineVersionInput({ provider }).

copyrightUrl is required for display, not plain-text data access. Every quotation page gets a visible link. Populate that page with sanitized publisher.copyrightHtml and publisher.infoHtml, the full translation name/abbreviation, the exact current dashboard/Appendix A citation, and a clickable rights-holder link. Raw metadata alone does not guarantee a complete notice. Applicable direct publisher formatting/citation agreements take precedence; resolve conflicts with API.Bible's remaining minimum requirements before use.

scripture-load.detail.reporting carries the FUMS token after rendering; detail.cache.expiresAt carries the absolute refresh deadline. Connect this to your actual-view reporter, including later cached displays. Rendered does not mean visible: hidden/offscreen components and prerenders need host visibility handling. Layout/theme changes do not fire another load event. No analytics are sent automatically. Cached displays refresh on the next load at the deadline; the host must refresh/remove long-lived mounted displays and honor earlier revocations. Expired server data causes an error instead of stale Scripture.

YouVersion: add a public app key

Get a public app key from YouVersion Platform. Replace YOUR_PUBLIC_APP_KEY in this example:

YouVersion requirements

YouVersion has no commercial-use flag. Its Platform terms do not grant Bible-content rights. Check the selected publisher's license and applicable Tool terms.

  • Paid applications are permitted subject to conditions, including conspicuously stating that the YouVersion Bible App is free. This is neither blanket permission nor a blanket commercial prohibition.
  • The terms prohibit using Tools with AI for open-ended user chat except to retrieve and display Scripture verbatim.
  • The terms prohibit using Tools to train, develop, refine, or improve AI. Cases beyond expressly permitted uses need prior written YouVersion approval.
  • AI-assisted engineering and content generation have separate permissions and conditions in those terms.

These requirements also appear in returned YouVersion instructions.

Use providers with browser components

With a bundler, pass the same provider object to the components and reference finder. This example uses fetch.bible; use an AO Lab or YouVersion provider object in the same way:

For an individual passage or translation picker, assign element.bibleProvider = provider. Remove any provider attribute because it takes precedence. fetch.bible requires a bundler import; it is not a script-tag provider name.

Script tags support AO Lab by default and YouVersion through explicit settings:

A standalone passage can set provider="youversion" and yvp-public-app-key="YOUR_PUBLIC_APP_KEY". With JavaScript, the equivalent options are { provider: "youversion", yvpPublicAppKey: "YOUR_PUBLIC_APP_KEY" }.

All built-in display providers add linked source credits. The fetch.bible adapter sanitizes native HTML, omits notes, loads its required stylesheet, and displays attribution separately.

Build a custom display provider

Implement the exported BibleProvider interface with id, defaultVersionId, and getPassage(versionId, passageId): Promise<PassageDisplay>. Return safe html, version: { id, abbreviation, title }, and an attribution string. Optional fields are safe attributionHtml for links, direction, containerAttributes, and stylesheets. Providers must sanitize both HTML fields before returning them.

Pass the object as provider to defineScripturePassage() or scriptureInline(), or assign it to a passage's bibleProvider property. The provider attribute takes precedence.

To support the translation picker, also implement listVersions(): Promise<BibleVersion[]>. Assign the provider to its bibleProvider property or pass it to defineVersionInput(). Catalogs are scoped to the provider, including the YouVersion public app key and API host. Switching providers does not guess an equivalent translation. For a DOM-free provider, see Effect configuration and custom providers.

Data reference

Use uppercase USFM book IDs, such as JHN. Passages support a verse (JHN.3.16), same-chapter range (JHN.3.16-18), or whole chapter (JHN.3).

Discovery follows the selected version's available content. Valid empty verse slots remain empty; nonexistent chapters or range endpoints fail rather than returning truncated text.

Passage data reference
Passage fieldMeaning
textPlain Scripture without verse numbers, editorial headings, notes, or attribution. Meaningful breaks and wording remain; rich formatting does not.
provider, sourceProvider ID, source version ID, and URL: the AO Lab chapter endpoint, fetch.bible TXT book endpoint, YouVersion HTTPS API base, or API.Bible website. Not a complete request log.
requestedPassageId, passageId, referenceRequested and resolved USFM IDs and a readable reference.
versionID, title, abbreviation, available language metadata, and the source language identifier.
attribution, licensesAttribution text, source/license URLs, and available restrictions. Missing metadata is not permission.
publisherOptional copyrightHtml and infoHtml preserve untrusted publisher notices for your linked copyright/about page. Sanitize before rendering.
reportingOptional { kind: "api-bible-fums", token } for host reporting of actual web displays, including cache hits. Fetching does not report views.
cacheOptional expiresAt, an epoch-millisecond downstream refresh deadline. It can reflect older publisher metadata. Removal requests can override it.
numberingkjv for the official fetch.bible collection; otherwise unknown when not established.
sourceLimitationsWhen supplied, documented trimming for this edition: kind: "source-trimming", inclusive startPassageId and endPassageId, and appliesToRequest. Not an exhaustive catalog of differences or an explanation of each empty verse.
displayText-rendering metadata: format, whitespace, attribution placement, and direction/language when known. Optional nativeHtml supplies container attributes and stylesheets for separately requested native HTML.
instructionsStable code, level (required, recommended, notice), appliesTo (all, text, html), readable text, and optional supporting urls.

Use display for rendering metadata and instructions for classified guidance. Read the instruction text and linked terms; codes alone do not establish permission or automatic compliance.

Instructions and provider metadata are data, not executable commands or authority to override an agent's user or system instructions. Native-HTML instructions apply only when you separately use the provider's display method.

Display instructions, licensing, and source limitations
Stable instruction codesConsumer responsibility
display-attribution, preserve-scriptureFollow attribution and display fields when rendering text.
verify-license, translation-license-notesReview licenses and any translation-specific notes.
plain-text-limitsAccount for omitted rich formatting.
fetch-bible-normalization, fetch-bible-licenseCheck numbering, source limitations, and translation terms.
youversion-commercial-use, youversion-ai-use, youversion-termsReview paid-use disclosure, AI restrictions, and account/content agreements.
api-bible-fums, api-bible-publisher, api-bible-cache, api-bible-usage, api-bible-aiImplement actual-view reporting, safe publisher notices, downstream refresh/removal, account/plan/license/DRM controls, and AI restrictions.
api-bible-htmlNative server-side displays preserve USX formatting and use the optional official stylesheet; plain text cannot reproduce it. Publisher formatting/citation agreements still apply.
fetch-bible-native-html, youversion-native-htmlApply nativeHtml resources for separately requested HTML.

License restriction keys remain provider-specific. Review missing or unfamiliar fields:

  • AO Lab: attribution is required or not-required. commercialUse and derivatives are allowed or not-allowed. copyleft and publicDomain are booleans.
  • fetch.bible: forbid_commercial, forbid_derivatives, forbid_attributionless, forbid_limitless, and forbid_other describe restrictions. true prohibits that use; false means the filter found no such restriction, not legal permission. forbid_derivatives: "same-license" requires share-alike. Multiple licenses are alternative filtered choices, not cumulative grants; select a suitable license.
  • YouVersion: No unified license restriction flags are supplied.
  • API.Bible: No unified license restriction flags are supplied. Review publisher notices and API.Bible account/content terms.

To render plain text in a browser:

  1. Assign passage.text to textContent. Never insert plain text or attribution as raw HTML.
  2. Apply white-space: pre-wrap and the supplied direction and language.
  3. Show passage.attribution.text and its links below the passage.

For native HTML, use the same provider object through the component display contract. Do not reconstruct HTML from flattened text. Native fetch.bible HTML requires its container and functional CSS. YouVersion HTML requires its returned container and stylesheets; do not download or self-host its font files.

fetch.bible uses KJV-normalized numbering and the Protestant 66-book canon. Its sourceLimitations identifies these documented trimmed ranges:

  • Exodus 35:1–40:38: eng_bstj, eng_bstjb, and grc_lxx.
  • Jeremiah 25:14–52:34: those editions plus eng_bst, eng_bstb, and grc_bre.

An overlapping range does not establish why a particular verse is empty. Psalm requests including verse 1 supplement TXT with native HTML's scriptural descriptive title, without editorial headings. No universal offline or persistent caching rights are established.

Errors, retries, and caching

Async methods reject with the original ScriptureError for expected failures. Import it from /data and use try/catch with error instanceof ScriptureError. Programming defects are not converted to expected errors.

Its code distinguishes invalid_reference, unavailable, unsupported, authentication, rate_limit, network, timeout, and invalid_response. Original diagnostics can remain in cause; do not expose them to readers. API.Bible discards upstream diagnostics and response-validation causes.

Built-in requests retry network and rate-limit failures twice, with exponential delays starting at 100ms and a 15-second deadline for each request's entire retry sequence. Other expected failures do not retry. Override RequestPolicy with Effect.provideService. Legacy Promise-only custom providers have a deadline but no automatic retries.

Client discovery and built-in adapter payload caches each hold at most 256 entries, not a byte limit. Upstream response memoization is disabled; failed or malformed payloads can be downloaded again.

  • AO Lab shares validated chapters. fetch.bible shares whole books and retains its collection catalog and loaded localized book-name metadata, whose size depends on the collection.
  • API.Bible discovery and publisher metadata expire after 14 days; passage payloads are not memoized. Other built-in cache entries retain their existing lifetime until clearing/eviction. Custom providers can set cacheTimeToLive to an Effect Duration.Input for discovery caches. API.Bible downstream caches must honor cache.expiresAt and any earlier removal request.
  • Run client.clearCache(), or provide its Layer to scripture.clearCache, to clear that client's discovery and its provider's payload caches. This does not invalidate other clients' discovery or the components' separate display/catalog caches.
  • The client does not memoize passage data or YouVersion attribution. Persistent caching is not provided.
Layers, tracing, cancellation, and custom data providers

Effects support fiber interruption and Effect.runPromise(program, { signal }). The simple async API does not expose an interruption option. AO Lab and API.Bible receive transport cancellation. YouVersion and fetch.bible SDKs do not expose transport cancellation: interruption stops waiting and ignores late results, not their underlying downloads. Components interrupt obsolete loads and use scoped listener/timer cleanup.

Named spans connect SDK, provider, and request operations to your application's Effect tracer. The SDK does not choose a telemetry backend or export to a hosted service. Inject providers through the BibleSource service and Layers for deterministic tests:

Custom BibleDataProvider implementations supply Effect-returning discovery and getPassageData methods, id, defaultVersionId, and a clearCache Effect value (Effect.void when unused), without a renderer. Use createScriptureClient({ provider }) or Layer.succeed(BibleSource, provider). Existing custom Promise-based display providers remain compatible; built-ins expose native operations through .effects. Missing data operations report unsupported. createAOLabProvider() is also available from /providers/ao-lab. Pure parsing, formatting, and DOM updates remain ordinary synchronous code inside these Effect boundaries.

CallResult
/data client's getPassage({ versionId, passageId })Promise returning ScripturePassage data.
/data/effect client's getPassage({ versionId, passageId })Lazy Effect returning the same ScripturePassage data.
provider.effects.getPassageData(versionId, passageId)Built-in provider's native Effect data operation.
provider.getPassage(versionId, passageId)Compatibility Promise returning HTML PassageDisplay for components.

Browser setup

Add the script

Add this script to register the components and turn Bible references into Scripture cards. Cards and passages use AO Lab's Berean Standard Bible (BSB) without an API key. To use another source, choose a provider.

Migrating from Scripture Inline

Bible SDK is the new name for Scripture Inline. Replace @faith-tools/scripture-inline with @faith-tools/bible-sdk in your dependencies and imports, keeping /data, /data/effect, and /providers/* subpaths. For script tags, update the package URL and use dist/bible-sdk.js; dist/scripture-inline.js remains an identical compatibility copy in the new package. Load only one script.

Use <bible-sdk-passage>, <bible-sdk-passage-input>, and <bible-sdk-version-input>. We mistakenly published bible-sk-* during the rebrand; those names are deprecated but still work, as do si-*. New tag constants use BIBLE_SDK_*_TAG; existing constants keep their values. Update CSS selectors and DOM queries when renaming tags. Scripts pinned to 0.9.1 or earlier need an upgrade for the corrected names.

Attributes (including data-scripture-inline-ignore), scriptureInline() and other JavaScript exports, scripture-* events, and CSS classes and custom properties remain compatible. Existing pinned old-package CDN URLs continue to use their original release; they do not automatically upgrade or register the new tags.

Bible references

Turn references such as "John 3:16" and "Rom 8:28-30" into links that open Scripture cards or route.bible. The links preserve the original text layout.

The reference finder skips code, pre, links, form fields, and elements marked data-scripture-inline-ignore.

We started with John 3:16, then read Rom 8:28-30 together. Paul's picture of love in 1 Cor. 13:4–7 stood out, and someone brought up Song of Songs 2:4.

For the week: pray through Ps 23 each morning, memorize 1 John 1:9, and read Gen. 1:1 through the end of the chapter. Meet at 10:30 in room 12.

Code is ignored: John 3:16
Options reference
Script tag and JavaScriptDefaultPurpose
data-provider
provider
ao-labao-lab or youversion. JavaScript also accepts a BibleProvider object. helloao is a deprecated input alias.
data-bible-version-id
bibleVersionId
Provider defaultBSB for AO Lab; 3034 for YouVersion. IDs are provider-specific.
data-yvp-public-app-key
yvpPublicAppKey
NoneYour public app key. Required only for YouVersion.
data-yvp-api-host
yvpApiHost
YouVersion's APIAnother YouVersion API host, for testing.
data-mode
mode
cardcard opens a Scripture card; link links to route.bible.
data-trigger
trigger
clickhover also opens cards on mouse hover.
data-yvp-bible-version-id
yvpBibleVersionId
3034YouVersion-only alias. bibleVersionId takes precedence.
data-reference
reference
headingThe card's reference layout, as on bible-sdk-passage.
rootWhole pageThe element to look for references in. Leave it unset on sites that replace <body>.
watchtrueAlso links references in content added later, such as pages that Turbo swaps in. false scans once. Mark content that a framework like React renders with data-scripture-inline-ignore.

Passage

<bible-sdk-passage> displays a passage with its required copyright attribution. Attributes choose what shows. CSS properties choose how it looks, so one rule can style every passage on a page.

Attributes, styling, and events
AttributeDefaultPurpose
yvp-public-app-keyThe script tag's keyYour public YouVersion Platform app key. It is safe to put in page markup. Only needed to override the key on the script tag.
providerThe script's provider, or ao-labao-lab or youversion. helloao is a deprecated input alias.
bible-version-idThe script's version, or provider defaultBSB for AO Lab; 3034 for YouVersion.
yvp-bible-version-id3034YouVersion-only alias. bible-version-id takes precedence.
passage-idNoneA USFM passage, such as ROM.8.28-30, or a whole chapter, ROM.8. Required.
referenceheadingWhere the reference shows: heading, citation, quote, or none.
verse-numbersShownhide removes verse numbers.
headingsShownhide removes section headings.
red-letterProvider stylingon colors marked words of Jesus red; off uses the text color. Omitted: red for AO Lab, YouVersion, and fetch.bible; official muted styling for API.Bible. Requires source markers.
themelightlight, dark, or auto to follow the system.
directionFrom the passageltr or rtl.
yvp-api-hostYouVersion's APIAnother YouVersion API host, for testing.
CSS propertyDefaultPurpose
--scripture-font-size20pxThe Bible text size. The reference line scales with it.
--scripture-line-height1.625Line height of the Bible text.
--scripture-font-familyGeorgia (AO Lab), Untitled Serif (YouVersion)Font of the Bible text.
--scripture-max-width32remLine length of the text, reference, and copyright.

The passage renders in a shadow root, so page CSS can't change it by accident. To restyle a piece on purpose, use a CSS part, such as bible-sdk-passage::part(citation) { font-style: italic; }.

PartWhat it is
textThe Bible text.
citationThe reference and version.
versionThe version abbreviation inside the citation.
attributionThe copyright line and Bible provider credit.
quoteThe block quote in the quote layout.
loaderThe spinner while the text loads.
errorThe message when the text can't load.
EventDetailWhen
scripture-loadprovider, passageId, bibleVersionId, bibleVersionThe passage has rendered, not necessarily become visible. The version has id, abbreviation, and title. API.Bible also supplies reporting and cache. YouVersion includes the original yvpBibleVersionId and yvpBibleVersion.
scripture-errorThe errorThe passage could not load.

Passage input

Use <bible-sdk-passage-input> to choose a book, chapter, verse, or range. Focus the empty field to browse every book. Type "Roman 8" to find Romans 8, or "Ps 119:" to list its 176 verses. The field stores a passage ID and submits it under name.

Value: (empty)

Attributes, styling, and events
AttributeDefaultPurpose
valueEmptyThe starting passage, as a USFM ID such as JHN.3.16.
nameNoneThe form field name. The form submits the passage ID.
placeholderNoneHint text in the empty field.
book-ordercanonicalcanonical lists books Genesis to Revelation; alphabetical lists them A to Z.
disabledOffTurns the field off.
EventDetailWhen
changepassageId, labelThe reader picks a passage, or clears the field. passageId is empty when cleared.

The field renders in a shadow root. It reads the page's --input, --ring, --radius, --popover, --accent, and --font-sans tokens when they exist. To restyle it further, use its parts: input, listbox, option, and count, such as bible-sdk-passage-input::part(input) { height: 2.5rem; }.

Translation picker

Use <bible-sdk-version-input> to search translations by name or abbreviation and filter by language. The field stores the selected provider's translation ID. Typing does not change the selection until you choose a translation.

Value: BSB

Attributes, styling, and events

Use the arrow keys and Enter to choose a translation, or Escape to close the list. Form reset restores the initial selection. If the catalog fails to load, select Retry.

AttributeDefaultPurpose
valueThe script's version, or provider defaultThe selected provider's translation ID, such as BSB.
nameNoneThe form field name. The form submits the translation ID.
languageSelected translation or browser languageA language tag such as en, or all. Filters choices, not the selected passage.
placeholderSearch translationsHint text in the search field.
disabledOffTurns the field off.
providerThe script's provider, or ao-labao-lab or youversion. helloao is a deprecated input alias.
yvp-public-app-keyThe script tag's keyYour public app key. Required only for YouVersion.
yvp-api-hostYouVersion's APIAnother YouVersion API host, for testing.
EventDetailWhen
changeprovider, bibleVersionId, bibleVersionThe reader picks a different translation.
scripture-versions-loadprovider, versionsThe provider's catalog loads.
scripture-errorThe errorThe catalog could not load.

The value property reads or sets the selected ID. bibleVersion has id, abbreviation, title, and optional language and languageName. An unavailable ID clears the field and marks it invalid. IDs belong to one provider, not a universal catalog. AO Lab's BSB and YouVersion's 3034 both name the Berean Standard Bible, but matching names or abbreviations do not guarantee identical editions.

The field uses the same page style tokens as the passage input. Its parts are language, input, listbox, option, status, and retry.

JavaScript setup

If you use a bundler, install @faith-tools/bible-sdk and register the components you need. The following example also finds references inside an article element:

Exports and shared catalog
ExportPurpose
scriptureInline(options)Finds and links references. Takes the Bible references options and returns { links, stop }; stop() restores the plain text.
defineScripturePassage(options)Registers <bible-sdk-passage>, deprecated <bible-sk-passage>, and compatible <si-passage>. Provider options set page-wide defaults; attributes override them.
aoLabProviderThe default provider, using the free-use-bible-api SDK. helloaoProvider remains a deprecated alias.
createYouVersionProvider({ yvpPublicAppKey, yvpApiHost })Creates the optional YouVersion provider.
definePassageInput()Registers <bible-sdk-passage-input>, deprecated <bible-sk-passage-input>, and compatible <si-passage-input>.
defineVersionInput(options)Registers <bible-sdk-version-input>, deprecated <bible-sk-version-input>, and compatible <si-version-input>. Shares provider defaults with defineScripturePassage().
listBibleVersions(options)Returns the provider's catalog as Promise<BibleVersion[]>. Accepts provider options; caches successful requests.
findReferences(text)Returns the references in a string, without touching the page.