An input element that sends its value to a server endpoint and renders the response body.
$ npm install @github/remote-input-element
import '@github/remote-input-element'<!-- Filter a list of items from the server -->
<remote-input src="/query" aria-owns="results">
<input>
</remote-input>
<ul id="results"></ul>A GET request will be sent to /query?q=${input.value}.
The parameter name (q) is customizable with the [param] attribute:
<!-- Live preview of Markdown -->
<remote-input src="/preview" aria-owns="md-preview" param="body">
<textarea></textarea>
</remote-input>
<div id="md-preview"></div>A boolean [loading] attribute is added to <remote-input> when a network request begins and removed when it ends.
.loading-icon { display: none; }
remote-input[loading] .loading-icon { display: inline; }loadstart- The server fetch has started.load- The network request completed successfully.error- The network request failed.loadend- The network request has completed.remote-input-success– Received a successful response (status code 200-299), and response HTML has been set. Bubbles.remote-input-error– Received a not successful response. Bubbles.
Browsers without native custom element support require a polyfill.
- Chrome
- Firefox
- Safari
- Microsoft Edge
npm install
npm test
This project uses Changesets to manage versioning, changelogs, and publishing to npm.
- Explicit changesets: For a user-facing change, run
npx changeset, describe the change, and choose apatch,minor, ormajorbump. Commit the generated changeset with the change. Explicit changesets take precedence over automatic release entries and are released immediately. - Automatic patch changesets: On pushes to
main, thereleaseworkflow runsscripts/prepare-release.mjs. When there is no explicit changeset, it creates one deterministic patch changeset per unreleased PR or commit. Each release-note entry links the PR (when available) and commit, followed by the change description. - Dependency-only releases: Non-security dependency updates wait until the current release is at least 30 days old. Dependency updates identified as security fixes are released immediately. Substantive non-dependency changes are also released immediately.
- Release pull request: The workflow opens or updates a Release tracking pull request using the unmodified
changesets/action@v2. Merging that pull request publishes the package to npm and records the new version and changelog in the repository. - Manual runs: Use the Run workflow button for the
Releaseworkflow (workflow_dispatch) to regenerate or refresh release tracking without waiting for another push tomain.
Distributed under the MIT license. See LICENSE for details.