No description
  • JavaScript 50.8%
  • TypeScript 40.9%
  • Dockerfile 8.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Marie Lucca 75d34b7a89
Merge pull request #51 from github/dependabot/npm_and_yarn/npm_and_yarn-b448f38fe0
Bump ws from 8.17.1 to 8.21.1 in the npm_and_yarn group across 1 directory
2026-07-15 21:55:42 -04:00
.devcontainer Add a .devcontainer 2022-02-28 17:05:20 +00:00
.github/workflows Simplify npm publish step in workflow 2026-05-05 12:05:43 -07:00
examples Load published module file in example 2019-10-18 16:51:35 -06:00
src fix prettier 2024-03-29 20:10:21 +00:00
test Fix CI failure by removing broken chromium npm package 2026-03-13 20:51:28 +00:00
.eslintignore Update lint 2024-03-29 20:04:25 +00:00
.eslintrc.json Update lint 2024-03-29 20:04:25 +00:00
.gitignore Initial commit 2019-04-30 20:55:11 +00:00
.prettierrc.json fix prettier 2024-03-29 20:10:21 +00:00
.travis.yml Initial commit 2019-04-30 20:55:11 +00:00
CODEOWNERS move AOR to primer 2022-09-23 18:45:11 +01:00
LICENSE Update element name 2019-04-30 16:59:28 -04:00
package-lock.json Bump ws in the npm_and_yarn group across 1 directory 2026-07-16 00:40:27 +00:00
package.json Fix CI failure by removing broken chromium npm package 2026-03-13 20:51:28 +00:00
README.md Remove note 2019-10-30 17:13:28 -04:00
tsconfig.json Add instanceof to error 2024-03-29 18:13:36 +00:00

<remote-input> element

An input element that sends its value to a server endpoint and renders the response body.

Installation

$ npm install @github/remote-input-element

Usage

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>

Styling loading state

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; }

Events

  • 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.

Browser support

Browsers without native custom element support require a polyfill.

  • Chrome
  • Firefox
  • Safari
  • Microsoft Edge

Development

npm install
npm test

License

Distributed under the MIT license. See LICENSE for details.