Scope Picker
kai-scope-picker
A lightweight filter dropdown for narrowing a conversation or search to a specific author or tag — drop it in a chat header and listen for one event.
- Shadow DOM
- 1 event
- Authors + tags sections
- 2 array properties
- Pairs with any header control
Preview
Section titled “Preview”Set availableAuthors and availableTags in JavaScript (arrays can’t be HTML attributes) and listen for kai-scope-change:
<kai-scope-picker id="scope"></kai-scope-picker>
<script type="module"> import '@kitn.ai/ui/elements'; const el = document.getElementById('scope');
el.availableAuthors = ['Alex Chen', 'Jordan Lee']; el.availableTags = ['design', 'engineering'];
el.addEventListener('kai-scope-change', (e) => { const { filters } = e.detail; console.log(filters ?? 'all'); });</script>current-label— HTML attribute controlling the trigger button text (default'All Content'). Update it after eachkai-scope-changeto reflect the active filter.kai-scope-change—detail.filtersisundefinedwhen “All Content” is selected, or{ authors?: string[], tags?: string[] }for a specific filter.- Passing an empty array for either property hides that section entirely.
Examples
Section titled “Examples”Authors and Tags
Section titled “Authors and Tags”Both sections populated — the dropdown shows an Authors group and a Tags group below “All Content”.
Authors Only
Section titled “Authors Only”Non-empty availableAuthors, empty availableTags — renders only the Authors section.
Tags Only
Section titled “Tags Only”Non-empty availableTags, empty availableAuthors — renders only the Tags section.
Minimal (No Filters)
Section titled “Minimal (No Filters)”Both arrays empty — the dropdown shows only “All Content”. Useful while options are loading asynchronously.
Custom Trigger Label
Section titled “Custom Trigger Label”Set current-label to reflect an already-active scope. Your app owns this state and updates the attribute on each kai-scope-change.
| Property | Type | Default | Notes |
|---|---|---|---|
| availableAuthors | string[] | [] | Authors to offer as scope filters. Set as a JS property. |
| availableTags | string[] | [] | Tags to offer as scope filters. Set as a JS property. |
| currentLabel | string | 'All Content' | The label shown on the trigger for the active scope. |
Events
Section titled “Events”| Event | Detail | Notes |
|---|---|---|
| kai-scope-change | | A scope was chosen (`undefined` filters = "All Content"). |
Composed from
Section titled “Composed from”This element wraps these SolidJS components — reach for them directly when you need finer control than the props expose.