{"id":2135184,"url":"https://github.com/samdutton/multi-input","last_synced_at":"2026-02-14T21:32:40.655Z","repository":{"id":43304131,"uuid":"191400968","full_name":"samdutton/multi-input","owner":"samdutton","description":"Custom input element to select multiple items using a datalist to suggest options.","archived":false,"fork":false,"pushed_at":"2019-06-21T13:37:20.000Z","size":45,"stargazers_count":41,"open_issues_count":2,"forks_count":2,"subscribers_count":0,"default_branch":"glitch","last_synced_at":"2025-10-11T05:43:07.173Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samdutton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-11T15:32:30.000Z","updated_at":"2025-08-23T23:40:57.000Z","dependencies_parsed_at":"2022-07-28T22:38:53.248Z","dependency_job_id":null,"html_url":"https://github.com/samdutton/multi-input","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/samdutton/multi-input","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samdutton%2Fmulti-input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samdutton%2Fmulti-input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samdutton%2Fmulti-input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samdutton%2Fmulti-input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samdutton","download_url":"https://codeload.github.com/samdutton/multi-input/tar.gz/refs/heads/glitch","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samdutton%2Fmulti-input/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29456253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T21:29:27.764Z","status":"ssl_error","status_checked_at":"2026-02-14T21:28:11.111Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-21T23:59:22.902Z","updated_at":"2026-02-14T21:32:40.638Z","avatar_url":"https://github.com/samdutton.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# \u0026lt;multi-input\u0026gt;\n\n\u003cimg width=\"340\" alt=\"multi-input custom element showing selection of multiple Shakespeare characters\" src=\"https://user-images.githubusercontent.com/205226/59288731-5744e400-8c6c-11e9-8b8d-4212d4504c86.png\"\u003e\n\nCustom element for selecting multiple items using an `input` and `datalist` to suggest options.\n\nDelete items with Backspace or by tapping/clicking an item's × icon.\n\n\u003cbr\u003e\n\n| [View and remix this project live on Glitch](https://glitch.com/~multi-input) |\n| --- |\n\n\u003cbr\u003e\n\n## Usage\n\n1. Add [multi-input.js](https://github.com/samdutton/multi-input/blob/glitch/multi-input.js) to your project and link to it: \n\n    ```html\n    \u003cscript src=\"multi-input.js\"\u003e\u003c/script\u003e\n    ```\n\n2. Wrap an `input` and a `datalist` in a `\u003cmulti-input\u003e` (see [index.html](https://github.com/samdutton/multi-input/blob/glitch/index.html#L14)): \n\n    ```html\n    \u003cmulti-input\u003e\n      \u003cinput list=\"speakers\"\u003e\n      \u003cdatalist id=\"speakers\"\u003e\n        \u003coption value=\"Banquo\"\u003e\u003c/option\u003e\n        \u003coption value=\"Celia\"\u003e\u003c/option\u003e\n        ...\n      \u003c/datalist\u003e\n    \u003c/multi-input\u003e\n    ```\n \n3. Get selected values like this (see [script.js](https://github.com/samdutton/multi-input/blob/glitch/script.js)):\n\n    ```js\n    const getButton = document.getElementById('get');\n    const multiInput = document.querySelector('multi-input'); \n    getButton.onclick = () =\u003e {\n      console.log(multiInput.getValues());\n    }\n    ```\n\u003cbr\u003e\n\n## Can I style the components?\n\nSure. \n\nThere are several custom properties:\n\n```\n--multi-input-border\n--multi-input-item-bg-color\n--multi-input-item-border\n--multi-input-item-font-size\n--multi-input-input-font-size\n```\n\nStyle components like this: \n\n``` css\nmulti-input {\n  --multi-input-border: 2px solid red;\n}\n```\n\n## Known issues\n\n### Problems with shadow DOM CSS pseudo classes\n\nTwo selectors have been added outside the shadow DOM using a `multi-input` selector:\n\n*  `::slotted(input)::-webkit-calendar-picker-indicator` doesn't work in any browser.\n*  `::slotted(div.item)::after` doesn't work in Safari.\n\n\u003cbr\u003e\n\n## My platform doesn't support custom elements :^|\n\nCustom elements are [widely supported by modern browsers](https://caniuse.com/#search=custom%20elements).\n\nHowever, `\u003cmulti-input\u003e` simply wraps an `input` element that has a `datalist`, so behaviour will degrade gracefully to a 'normal' `datalist` experience in browsers without custom element support.\n\n\u003cbr\u003e\n    \n## My platform doesn't support datalist :^|\u0026nbsp;:^|\n\nThe `datalist` element is [supported by all modern browsers](https://caniuse.com/#feat=datalist).\n\nIf your target browser doesn't support `datalist`, behaviour will fall back to the plain old `input` experience.\n  \n\u003cbr\u003e\n\n## Obligatory screencast\n\n\u003cimg src=\"https://cdn.glitch.com/dda744c5-58a9-4809-897c-68396377983a%2Fmulti-input.gif?v=1560266060751\" alt=\"Screencast showing Shakespeare character names being selected via a multi-input custom element\" width=\"400\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamdutton%2Fmulti-input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamdutton%2Fmulti-input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamdutton%2Fmulti-input/lists"}