speciesfyi-embed
v1.1.0
Published
Embed SpeciesFYI biodiversity widgets — taxonomy cards, IUCN badges, population trends. Zero dependencies, Shadow DOM, 4 themes.
Downloads
241
Maintainers
Readme
speciesfyi-embed
Embed SpeciesFYI widgets — species, glossary terms, interactive tools, and inline elements — on any website. 8 widget types, zero dependencies, Shadow DOM style isolation, 4 built-in themes (light, dark, sepia, auto), 2 styles (modern, organic), and live data from the SpeciesFYI database.
Every widget includes a "Powered by SpeciesFYI" backlink directing readers to the full reference.
Try the interactive widget builder at widget.speciesfyi.com
Quick Start
<!-- Place widget div where you want it to appear -->
<div data-speciesfyi="entity" data-slug="species" data-theme="light"></div>
<!-- Load the embed script once, anywhere on the page -->
<script src="https://cdn.jsdelivr.net/npm/speciesfyi-embed@1/dist/embed.min.js"></script>That's it. The widget fetches data from the SpeciesFYI API and renders with full style isolation.
Widget Types
| Type | Usage | Description |
|------|-------|-------------|
| entity | <div data-speciesfyi="entity" data-slug="..."></div> | Entity detail card — species, bird, fish, plant, or dinosaur |
| glossary | <div data-speciesfyi="glossary" data-slug="..."></div> | Glossary term definition with cross-references |
| guide | <div data-speciesfyi="guide" data-slug="..."></div> | Guide summary card with key takeaways |
| compare | <div data-speciesfyi="compare" data-slug="..."></div> | Side-by-side entity comparison |
| search | <div data-speciesfyi="search" data-slug="..."></div> | Search box linking to the full database |
| iucn-badge | <div data-speciesfyi="iucn-badge" data-slug="..."></div> | IUCN conservation status badge with 9 status levels |
| iucn-inline | <div data-speciesfyi="iucn-inline" data-slug="..."></div> | Inline IUCN status colored pill |
| taxonomy-inline | <div data-speciesfyi="taxonomy-inline" data-slug="..."></div> | Italic scientific binomial name |
Widget Options
| Attribute | Values | Default | Description |
|-----------|--------|---------|-------------|
| data-speciesfyi | entity, compare, glossary, guide, search, [tools] | required | Widget type |
| data-slug | e.g. "species" | — | Entity slug from the SpeciesFYI database |
| data-theme | light, dark, sepia, auto | light | Visual theme (auto follows OS preference) |
| data-styleVariant | modern, organic | modern | Widget design style |
| data-size | default, compact, large | default | Widget size |
| data-placeholder | any string | "Search Species..." | Search box placeholder |
Themes
<!-- Light (default) -->
<div data-speciesfyi="entity" data-slug="species" data-theme="light"></div>
<!-- Dark -->
<div data-speciesfyi="entity" data-slug="species" data-theme="dark"></div>
<!-- Sepia -->
<div data-speciesfyi="entity" data-slug="species" data-theme="sepia"></div>
<!-- Auto — follows OS dark/light preference -->
<div data-speciesfyi="entity" data-slug="species" data-theme="auto"></div>Styles
<!-- Modern (default) — clean lines, rounded corners, accent gradients -->
<div data-speciesfyi="entity" data-slug="species" data-styleVariant="modern"></div>
<!-- Organic — natural curves, earth-tone aesthetics, field-guide look -->
<div data-speciesfyi="entity" data-slug="species" data-styleVariant="organic"></div>Web Components (Custom Elements)
As an alternative to data-* attributes, you can use native HTML custom elements:
<!-- Custom element form -->
<speciesfyi-entity slug="species" theme="light"></speciesfyi-entity>
<speciesfyi-compare slugs="species,other-slug"></speciesfyi-compare>
<speciesfyi-search placeholder="Search Species..."></speciesfyi-search>
<script src="https://cdn.jsdelivr.net/npm/speciesfyi-embed@1/dist/embed.min.js"></script>Use style-variant (not style) to avoid conflicts with the HTML reserved style attribute.
Examples
Entity Card
<div data-speciesfyi="entity" data-slug="species" data-theme="light"></div>
<script src="https://cdn.jsdelivr.net/npm/speciesfyi-embed@1/dist/embed.min.js"></script>Side-by-Side Comparison
<div data-speciesfyi="compare" data-slugs="species,other-slug"></div>
<script src="https://cdn.jsdelivr.net/npm/speciesfyi-embed@1/dist/embed.min.js"></script>Search Box
<div data-speciesfyi="search" data-placeholder="Search Species..."></div>
<script src="https://cdn.jsdelivr.net/npm/speciesfyi-embed@1/dist/embed.min.js"></script>Glossary Term
<div data-speciesfyi="glossary" data-slug="example-term" data-theme="light"></div>
<script src="https://cdn.jsdelivr.net/npm/speciesfyi-embed@1/dist/embed.min.js"></script>CDN Options
jsDelivr (recommended — global CDN, auto-updates with npm)
<script src="https://cdn.jsdelivr.net/npm/speciesfyi-embed@1/dist/embed.min.js"></script>Specific version (production stability)
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/embed.min.js"></script>npm (for bundlers)
npm install speciesfyi-embedimport 'speciesfyi-embed';Technical Details
- Shadow DOM: Complete style isolation — no CSS conflicts with your site
- Zero dependencies: No jQuery, React, or any external library
- 2 styles: Modern (accent gradients) and Organic (natural curves, field-guide aesthetic)
- 4 themes: Light, Dark, Sepia, Auto (OS preference detection)
- CORS: SpeciesFYI API has CORS enabled for all origins
- MutationObserver: Works with dynamically added elements (SPAs)
- IntersectionObserver: Lazy loading — widgets only fetch when entering viewport (200px margin)
- Rich Snippets: DefinedTerm JSON-LD injected for glossary widgets
- Bundle size: Tree-shaken per site — only includes tools available on SpeciesFYI
Learn More About Species
Visit speciesfyi.com — SpeciesFYI is a comprehensive species reference with interactive tools, guides, and developer resources.
- API docs: speciesfyi.com/developers/
- Widget builder: widget.speciesfyi.com
- npm package: npmjs.com/package/speciesfyi-embed
- GitHub: github.com/fyipedia/speciesfyi-embed
Nature FYI Family
Part of FYIPedia — open-source developer tools ecosystem. Nature FYI covers species taxonomy, ornithology, marine biology, botany, and paleontology. Hub: naturefyi.com.
| Site | Domain | Focus | Package | |------|--------|-------|---------| | SpeciesFYI | speciesfyi.com | Species taxonomy, biodiversity, IUCN conservation status | npm | | BirdFYI | birdfyi.com | 11,251 birds, biometrics, conservation, habitats | npm | | FishFYI | fishfyi.com | 35,729 fish, game fishing, aquarium care, compatibility | npm | | PlantFYI | plantfyi.com | 379,774 plants, hardiness zones, bloom seasons, gardening | npm | | DinoFYI | dinofyi.com | 6,142 dinosaurs, geological periods, paleontology | npm |
License
MIT — see LICENSE.
Built with care by FYIPedia.
