Skip to content

Chemical Tooltips ​

The chemical tooltip module uses the MyChem.info adapter to resolve chemical names and identifiers.

Common sections include identity, structure and properties, summaries, synonyms, chemical classes, pharmacology, regulatory information, safety annotations, and external identifiers.

Import ​

ts
import { ChemicalTooltip } from 'bio-tooltips/mychem';
import 'bio-tooltips/style.css';

Markup ​

html
<span class="chemical-tooltip" data-query="2244" data-scope="pubchem">aspirin</span>
<span class="chemical-tooltip" data-query="CHEMBL25" data-scope="chembl">aspirin</span>
<span class="chemical-tooltip" data-lookup="best-guess">caffeine</span>

Prefer data-query plus data-scope for stable chemical tooltips. The visible text remains the page label, while data-query is the MyChem lookup value.

Visible-text name searches are still supported as experimental best-guess lookups. They are convenient for drafts, but chemical names can match molecules, salts, products, packages, or synonyms.

html
<span class="chemical-tooltip">aspirin</span>

When data-query is omitted, the element text becomes the query. data-scope tells MyChem.info which identifier field to search.

Initialize ​

ts
const cleanup = ChemicalTooltip.init({
  selector: '.chemical-tooltip'
});

The default selector is .chemical-tooltip.

Supported Scopes ​

data-scopeMyChem scope
namename
inchiinchi
inchikeyinchikey
chebichebi.id
chemblchembl.molecule_chembl_id
drugbankdrugbank.id
pubchem or cidpubchem.cid
uniiunii.unii

Unknown scopes fall back to name.

Lookup Modes ​

ModeHow to use itBehavior
idAny non-name data-scope, or data-lookup="id"Uses identifier-oriented lookup. Supported MyChem annotation IDs are fetched directly.
best-guessDefault for name, or data-lookup="best-guess"Searches by name and prefers molecule-backed records over product-only matches.

Older identifier markup remains valid:

html
<span class="chemical-tooltip" data-scope="pubchem">2244</span>