Appearance
NostrUserSearch Component
Displays a search box and renders the search results.
Relies on NIP-50 queries to specific relays.
Usage
html
<nostr-user-search placeholder="Search users..." />
Attributes
relays
: Comma-separated list of relay URLslimit
: Maximum number of results (default: 10)placeholder
: Placeholder text for search inputvalue
: Initial search valuetemplate
: ID of template element to use for custom rendering
Styling Parts
wrapper
: Main containerinput
: Search input fieldresults
: Results containeritem
: Individual result itempicture
: User profile picturename
: User display namenip05
: NIP-05 identifier
Events
selected
: Fired when an item is picked from the suggestion list. Event detail includespubkey
,npub
and ametadata
object.
External Templates
Supports external templates through the template
attribute:
html
<template id="search-template">
<div part="wrapper">
<input type="search" part="input" />
<ul part="results">
<template>
<li part="item">
<img part="picture" />
<span part="name"></span>
<span part="nip05"></span>
</li>
</template>
</ul>
</div>
</template>
<nostr-user-search template="search-template" />