An embeddable, dependency-free search box for 139,714 archival items. Results open at theodorerooseveltcenter.org.
Two lines. No build step, no framework, no dependencies.
<script src="https://trc.labs.trlibrary.com/trc-search.min.js" defer></script>
<trc-search></trc-search>
| Attribute | Description |
|---|---|
placeholder | Placeholder text for the input. |
collection | Lock all searches to one collection slug, e.g. harvard-college-library. |
accent | Shorthand for --trc-rust. Any CSS color. |
theme | inherit uses the host page's fonts. auto enables dark mode. |
preview | off disables live count and preview requests. |
data-base | Override where the widget loads its index from. |
The widget follows the Theodore Roosevelt Center's palette and typography by default.
Every value is a CSS custom property, so any single token can be overridden from the host page without forking the widget:
trc-search {
--trc-rust: #8c1515; /* accent and links */
--trc-navy: #1a1a1a; /* text */
--trc-sage: #e8e2d5; /* filter chips */
--trc-paper: #fafafa; /* preview panel */
--trc-radius: 0; /* square corners */
--trc-body: inherit; /* host page's font */
}
theme="inherit" to adopt the host's typography instead.
<trc-search collection="harvard-college-library"
placeholder="Search the Harvard materials"></trc-search>
The element emits trc-filter whenever the active filters change, so a host page can track usage or mirror state.
document.querySelector('trc-search')
.addEventListener('trc-filter', e => console.log(e.detail.filters, e.detail.url));
Autocomplete runs entirely against a static index built weekly from the Center's public WordPress API and served from GitHub Pages — so typing costs their servers nothing, and suggestions keep working even when the archive itself is slow or down. Result counts and previews are fetched live, and fail quietly when unavailable.