Back to Share

List Component

A unified vocabulary list/selection component supporting multiple display modes: tree, dropdown, radio, and table.

<prez-list>

Interactive Preview

When to Use

  • Form inputs requiring concept selection
  • Browsing hierarchical vocabularies
  • Quick search in large vocabularies
  • Multi-select scenarios
  • Tabular display of vocabulary data

Display Modes

select (default)
Tree view with expand/collapse. Best for browsing hierarchical vocabularies.
dropdown
Dropdown button with tree popover. Best for form inputs.
radio
Radio button selection. Best for small vocabularies.
table
Tabular display with configurable columns. Best for data-heavy views.

Available Fields

Use the fields attribute to specify which fields to display (comma-separated).

FieldDescription
iriConcept IRI
labelConcept preferred label
notationConcept notation
descriptionConcept description
altLabelsAlternative labels
broaderBroader concept IRIs
narrowerNarrower concept IRIs

Code Examples

Include the script tag in your HTML head or before the component. The component will auto-detect its base URL.

Properties

PropertyTypeDefaultDescription
vocabstringVocabulary slug for auto-resolved URL
vocab-urlstringDirect URL to vocabulary JSON (overrides vocab)
base-urlstringautoBase URL for vocab resolution
typestring"select"Display type: select, dropdown, radio, or table
valuestringSelected concept IRI (single mode)
valuesstring[][]Selected IRIs as JSON array (multiple mode)
flatbooleanfalseRender as flat list instead of tree hierarchy
searchbooleanfalseShow search/filter input
multiplebooleanfalseEnable multiple selection
horizontalbooleanfalseHorizontal layout (radio type only)
fieldsstringComma-separated fields for table columns (table type)
max-levelnumber1Tree expansion depth (-1=all, 0=collapsed)
show-countbooleanfalseShow descendant count on parent nodes
show-descriptionbooleanfalseShow concept descriptions
show-selectedbooleantrueHighlight selected items
placeholderstring"Select..."Placeholder text (dropdown mode)
disabledbooleanfalseDisable the component
langstring"en"Preferred language for labels
themestring"auto"Color theme: "light", "dark", or "auto" (follows system)
sparql-endpointstringSPARQL endpoint URL — enables dynamic SPARQL mode
vocab-iristringConceptScheme IRI (required in SPARQL mode)
named-graphstringNamed graph to query within (optional, SPARQL mode)
timeoutnumber10000Request timeout in ms (SPARQL mode)
label-predicatesstring"skos:prefLabel,dcterms:title,rdfs:label"Comma-separated label predicates for SPARQL resolution
description-predicatesstring"skos:definition,dcterms:description"Comma-separated description predicates for SPARQL resolution

Methods

loadVocab()Manually trigger vocabulary reload

Access methods via JavaScript:

const el = document.querySelector('prez-list');
el.loadVocab(); // Reload vocabulary data

Events

prez-changeFired when selection changes

Event Detail:

valuestring | string[]Selected IRI(s)
vocabstringVocabulary slug
conceptsobject | object[]Full concept data for selection
prez-loadFired when vocabulary loads successfully

Event Detail:

vocabstringVocabulary slug
urlstringResolved vocabulary URL
conceptCountnumberNumber of concepts loaded
prez-errorFired when loading fails

Event Detail:

vocabstringVocabulary slug
urlstringAttempted URL
errorstringError message

Example:

document.querySelector('prez-list')
  .addEventListener('prez-click', (e) => {
    console.log('Clicked:', e.detail);
  });

Styling

Components use Shadow DOM with encapsulated styles. Customize appearance using inherited CSS properties or by wrapping in a styled container.

Inherited Properties

PropertyDefaultDescription
font-familysystem-ui, sans-serifFont family inherited into shadow DOM
font-size0.875remBase font size
--prez-bgautoBackground color (auto-themed)
--prez-textautoPrimary text color (auto-themed)
--prez-borderautoBorder color (auto-themed)
--prez-primaryautoPrimary brand color (auto-themed)

Examples

Basic Styling

Override inherited CSS properties

prez-list {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  width: 300px;
}

Full Width

Set component to fill container

prez-list {
  width: 100%;
  max-width: 400px;
}

Container Styling

Style the containing element

.vocab-container {
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

.vocab-container prez-list {
  width: 100%;
}

Installation

CDN / Script Tag

<script src="/web-components/prez-lite.min.js" type="module"></script>

npm (from GitHub)

# Public repo
npm install hjohns/prez-lite#subdirectory:packages/web-components

# Private repo (with token)
npm install git+https://<TOKEN>@github.com/hjohns/prez-lite.git#subdirectory:packages/web-components

npm (when published)

npm install @prez-lite/web-components

See the README for full installation and configuration details.

GeoSpecimens Vocabulary Browser

Part of the GeoSpecimens Data Mobilization Platform

© 2026 All rights reserved.

Powered by Prez Lite