Skip to content
kitn AI/UI

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

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 each kai-scope-change to reflect the active filter.
  • kai-scope-changedetail.filters is undefined when “All Content” is selected, or { authors?: string[], tags?: string[] } for a specific filter.
  • Passing an empty array for either property hides that section entirely.

Both sections populated — the dropdown shows an Authors group and a Tags group below “All Content”.

Non-empty availableAuthors, empty availableTags — renders only the Authors section.

Non-empty availableTags, empty availableAuthors — renders only the Tags section.

Both arrays empty — the dropdown shows only “All Content”. Useful while options are loading asynchronously.

Set current-label to reflect an already-active scope. Your app owns this state and updates the attribute on each kai-scope-change.

PropertyTypeDefaultNotes
availableAuthors [] Authors to offer as scope filters. Set as a JS property.
availableTags [] Tags to offer as scope filters. Set as a JS property.
currentLabel 'All Content' The label shown on the trigger for the active scope.
EventDetailNotes
A scope was chosen (`undefined` filters = "All Content").

This element wraps these SolidJS components — reach for them directly when you need finer control than the props expose.

ChatScopePicker