π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
<template>
<div class="segmented">
<button v-for="item in items" :key="item.id" :class="{ active: item.id === selected }" @click="selectItem(item.id)">{{ item.label }}</button>
</div>
</template>
<script setup lang="ts">
const props = defineProps<{
items: Array<{ id: number | string; label: string }>;
modelValue: number | string | null | undefined;
}>();
const emit = defineEmits<{
(e: 'update:modelValue', value: number | string | null | undefined): void;
}>();
const selected = ref(props.modelValue);
const selectItem = (id: number | string) => {
selected.value = id;
emit('update:modelValue', id);
};
</script>
<style scoped lang="scss">
.segmented {
display: flex;
gap: 0.5rem;
width: 100%;
button {
flex: 1;
padding: 0.6rem;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--surface-raised);
cursor: pointer;
&.active {
border-color: var(--primary);
color: white;
background: var(--primary);
}
}
}
</style>