A Web Component that provides typeahead suggestions for AT Protocol (Bluesky) handles. Uses the public app.bsky.actor.searchActorsTypeahead API directly from the client.
···11+MIT License
22+33+Copyright (c) 2025 Tijs Teulings
44+55+Permission is hereby granted, free of charge, to any person obtaining a copy
66+of this software and associated documentation files (the "Software"), to deal
77+in the Software without restriction, including without limitation the rights
88+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99+copies of the Software, and to permit persons to whom the Software is
1010+furnished to do so, subject to the following conditions:
1111+1212+The above copyright notice and this permission notice shall be included in all
1313+copies or substantial portions of the Software.
1414+1515+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121+SOFTWARE.
+66
README.md
···11+# actor-typeahead
22+33+A Web Component that provides typeahead suggestions for AT Protocol (Bluesky)
44+handles. Uses the public `app.bsky.actor.searchActorsTypeahead` API directly
55+from the client.
66+77+## Usage
88+99+```html
1010+<script type="module" src="https://esm.sh/jsr/@tijs/actor-typeahead"></script>
1111+1212+<actor-typeahead>
1313+ <input type="text" placeholder="alice.bsky.social" />
1414+</actor-typeahead>
1515+```
1616+1717+Or import in JavaScript/TypeScript:
1818+1919+```ts
2020+import "@tijs/actor-typeahead";
2121+```
2222+2323+## Attributes
2424+2525+| Attribute | Default | Description |
2626+| --------- | ----------------------------- | ------------------------- |
2727+| `host` | `https://public.api.bsky.app` | API host for actor search |
2828+| `rows` | `5` | Max suggestions to show |
2929+3030+## CSS Custom Properties
3131+3232+Style the dropdown via custom properties on `<actor-typeahead>`:
3333+3434+| Property | Default |
3535+| ------------------------- | --------- |
3636+| `--color-background` | `#ffffff` |
3737+| `--color-border` | `#e5e7eb` |
3838+| `--color-shadow` | `#000000` |
3939+| `--color-hover` | `#fff1f1` |
4040+| `--color-avatar-fallback` | `#fecaca` |
4141+| `--radius` | `8px` |
4242+| `--padding-menu` | `4px` |
4343+4444+## How it works
4545+4646+Wrap any `<input>` element. The component listens for `input` events on the
4747+slotted input, fetches matching actors, and displays them in a dropdown. When a
4848+suggestion is selected (via click or keyboard), the input value is set and a
4949+native `input` event is dispatched so frameworks (React, etc.) can detect the
5050+change.
5151+5252+Keyboard navigation: Arrow keys, Page Up/Down, Enter to select, Escape to
5353+dismiss.
5454+5555+## Disabling auto-registration
5656+5757+Pass `?tag=none` in the import URL to prevent auto-registration:
5858+5959+```ts
6060+import { ActorTypeahead } from "@tijs/actor-typeahead?tag=none";
6161+customElements.define("my-typeahead", ActorTypeahead);
6262+```
6363+6464+## License
6565+6666+MIT