namefyi-embed
v1.1.0
Published
Embed NameFYI widgets — name cards, Hanja characters, Five Elements, random names. 35,585 names. Zero dependencies, Shadow DOM, 4 themes.
Downloads
38
Maintainers
Readme
namefyi-embed
Embed NameFYI widgets — names, glossary terms, interactive tools, and inline elements — on any website. 10 widget types, zero dependencies, Shadow DOM style isolation, 4 built-in themes (light, dark, sepia, auto), 2 styles (modern, clean), and live data from the NameFYI database.
Every widget includes a "Powered by NameFYI" backlink directing readers to the full reference.
Try the interactive widget builder at widget.namefyi.com
Quick Start
<!-- Place widget div where you want it to appear -->
<div data-namefyi="entity" data-slug="names" data-theme="light"></div>
<!-- Load the embed script once, anywhere on the page -->
<script src="https://cdn.jsdelivr.net/npm/namefyi-embed@1/dist/embed.min.js"></script>That's it. The widget fetches data from the NameFYI API and renders with full style isolation.
Widget Types
| Type | Usage | Description |
|------|-------|-------------|
| entity | <div data-namefyi="entity" data-slug="..."></div> | Entity detail card — unit, city, holiday, or name |
| glossary | <div data-namefyi="glossary" data-slug="..."></div> | Glossary term definition with cross-references |
| guide | <div data-namefyi="guide" data-slug="..."></div> | Guide summary card with key takeaways |
| search | <div data-namefyi="search" data-slug="..."></div> | Search box linking to the full database |
| compare | <div data-namefyi="compare" data-slug="..."></div> | Side-by-side entity comparison |
| faq | <div data-namefyi="faq" data-slug="..."></div> | FAQ accordion with expand/collapse |
| random | <div data-namefyi="random" data-slug="..."></div> | Random name generator — filter by culture and gender |
| character | <div data-namefyi="character" data-slug="..."></div> | Hanja character card with stroke order and meanings |
| elements | <div data-namefyi="elements" data-slug="..."></div> | Inline Five Elements colored badges (Metal/Wood/Water/Fire/Earth) |
| stroke | <div data-namefyi="stroke" data-slug="..."></div> | Inline stroke count pill for Hanja characters |
Widget Options
| Attribute | Values | Default | Description |
|-----------|--------|---------|-------------|
| data-namefyi | entity, compare, glossary, guide, search, faq, [tools] | required | Widget type |
| data-slug | e.g. "names" | — | Entity slug from the NameFYI database |
| data-theme | light, dark, sepia, auto | light | Visual theme (auto follows OS preference) |
| data-style | modern, clean | modern | Widget design style |
| data-size | default, compact, large | default | Widget size |
| data-placeholder | any string | "Search Names..." | Search box placeholder |
Themes
<!-- Light (default) -->
<div data-namefyi="entity" data-slug="names" data-theme="light"></div>
<!-- Dark -->
<div data-namefyi="entity" data-slug="names" data-theme="dark"></div>
<!-- Sepia -->
<div data-namefyi="entity" data-slug="names" data-theme="sepia"></div>
<!-- Auto — follows OS dark/light preference -->
<div data-namefyi="entity" data-slug="names" data-theme="auto"></div>Styles
<!-- Modern (default) — clean lines, rounded corners, accent gradients -->
<div data-namefyi="entity" data-slug="names" data-style="modern"></div>
<!-- Clean — minimal borders, utility-focused, data-first aesthetic -->
<div data-namefyi="entity" data-slug="names" data-style="clean"></div>Web Components (Custom Elements)
As an alternative to data-* attributes, you can use native HTML custom elements:
<!-- Custom element form -->
<namefyi-entity slug="names" theme="light"></namefyi-entity>
<namefyi-compare slugs="names,other-slug"></namefyi-compare>
<namefyi-search placeholder="Search Names..."></namefyi-search>
<script src="https://cdn.jsdelivr.net/npm/namefyi-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-namefyi="entity" data-slug="names" data-theme="light"></div>
<script src="https://cdn.jsdelivr.net/npm/namefyi-embed@1/dist/embed.min.js"></script>Side-by-Side Comparison
<div data-namefyi="compare" data-slugs="names,other-slug"></div>
<script src="https://cdn.jsdelivr.net/npm/namefyi-embed@1/dist/embed.min.js"></script>Search Box
<div data-namefyi="search" data-placeholder="Search Names..."></div>
<script src="https://cdn.jsdelivr.net/npm/namefyi-embed@1/dist/embed.min.js"></script>Glossary Term
<div data-namefyi="glossary" data-slug="example-term" data-theme="light"></div>
<script src="https://cdn.jsdelivr.net/npm/namefyi-embed@1/dist/embed.min.js"></script>CDN Options
jsDelivr (recommended — global CDN, auto-updates with npm)
<script src="https://cdn.jsdelivr.net/npm/namefyi-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 namefyi-embedimport 'namefyi-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 Clean (minimal, data-first)
- 4 themes: Light, Dark, Sepia, Auto (OS preference detection)
- CORS: NameFYI 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 NameFYI
Learn More About Names
Visit namefyi.com — NameFYI is a comprehensive names reference with interactive tools, guides, and developer resources.
- API docs: namefyi.com/developers/
- Widget builder: widget.namefyi.com
- npm package: npmjs.com/package/namefyi-embed
- GitHub: github.com/fyipedia/namefyi-embed
Utility FYI Family
Part of FYIPedia — open-source developer tools ecosystem. Utility FYI covers unit conversion, timezones, holidays, and names. Hub: toolfyi.com.
| Site | Domain | Focus | Package | |------|--------|-------|---------| | UnitFYI | unitfyi.com | 220 units, 20 categories, offline converter | npm | | TimeFYI | timefyi.com | 6,040 cities, live world clock, sunrise data | npm | | HolidayFYI | holidayfyi.com | 626 holidays, 197 countries, live today feed | npm | | NameFYI | namefyi.com | 35,585 names, Hanja characters, Five Elements | npm |
FYIPedia Developer Tools
| Package | PyPI | npm | Description | |---------|------|-----|-------------| | colorfyi | PyPI | npm | Color conversion, WCAG contrast, harmonies — colorfyi.com | | emojifyi | PyPI | npm | Emoji encoding & metadata for 3,953 emojis — emojifyi.com | | unitfyi | PyPI | npm | Unit conversion, 220 units — unitfyi.com | | timefyi | PyPI | npm | Timezone ops & business hours — timefyi.com | | holidayfyi | PyPI | npm | Holiday dates & Easter calculation — holidayfyi.com | | namefyi | PyPI | npm | Korean romanization & Five Elements — namefyi.com | | fyipedia | PyPI | — | Unified CLI for all FYI tools — fyipedia.com |
License
MIT — see LICENSE.
Built with care by FYIPedia.
