ItemSelected
A list of JSKOS items where items can be reordered and removed from.
It supports three views:
list: list rendering viaItemListtags: inline list of compact tagstable: rows with ordering controls (up/down)
Uses ItemName to display items.
Props and models
modelValue(array) selected items. Use watch option{ deep: true }to get change events.view(string) - display mode:"tags" | "table" | "list"- default:
"tags"
- default:
orderable(boolean) - show move up/down buttons intableview- default:
false
- default:
itemNameOptions(object) - props forwarded toItemName- default:
{ draggable: false } - Field
draggableis set tofalse, unless explicitly enabled
- default:
removable(boolean) — iftrue, show a remove icon inview="list"(like Cocoda)
default:falseremoveable(boolean) — legacy spelling, treated likeremovable
default:false
Events
select
Emitted when the user clicks on an item Payload:{ item }
CSS Variables
--jskos-vue-itemSelected-tags-bgColor- background color of tags. Set to--jskos-vue-highlight-bgColorby default.--jskos-vue-itemSelected-tags-color- text color of tags. Set toinheritby default.
Example
View:
vue
<template>
<ItemSelected
v-model="selected"
:view="view"
:orderable="orderable"
:removable="removable"
@select="onSelect"
@change="onChange" />
</template>
<script setup>
import { ref } from "vue"
import { ItemSelected } from "jskos-vue"
const view = ref("tags")
const orderable = ref(true)
const removable = ref(true)
const selected = ref([
{ uri: "urn:lang:en", prefLabel: { en: "English" }, notation: ["EN"] },
{ uri: "urn:lang:de", prefLabel: { en: "German" }, notation: ["DE"] },
{ uri: "urn:lang:it", prefLabel: { en: "Italian" }, notation: ["IT"] },
])
function onSelect({ item }) {
window.alert(`Clicked on ${item.uri}`)
}
function onChange(ev) {
console.log("change", ev)
}
</script>