Skip to content

Sidebar ​

Yig‘iluvchi ichki menyular, qidiruv, drag & drop, o‘lcham o‘zgartirish, guruhlar, belgilar, yig‘ilgan rejim, mini rejim va boshqalarni qo‘llab-quvvatlaydigan vertikal yon panel navigatsiyasi.

Gorizontal navigatsiya uchun Menu ga qarang.

Basic ​

vue
<script setup>
import { ref } from 'vue'
import { VxSidebar } from 'veloxui'

const active = ref('inbox')

const items = [
  { key: 'inbox', label: 'Inbox', icon: 'mail' },
  { key: 'starred', label: 'Starred', icon: 'star' },
  { key: 'drafts', label: 'Drafts', icon: 'file' },
  { key: 'trash', label: 'Trash', icon: 'trash' },
]
</script>

<template>
  <VxSidebar v-model="active" :items="items" />
</template>

With Badges ​

vue
<VxSidebar v-model="active" :items="[
  { key: 'inbox', label: 'Inbox', icon: 'mail', badge: 12, badgeType: 'primary' },
  { key: 'starred', label: 'Starred', icon: 'star', badge: 'New', badgeType: 'success' },
  { key: 'alerts', label: 'Alerts', icon: 'heart', badge: 3, badgeType: 'danger' },
]" />

Nested Submenus ​

Ichki elementlarni ochish/yopish uchun ota elementga bosing.

vue
<VxSidebar v-model="active" :items="[
  {
    key: 'projects',
    label: 'Projects',
    icon: 'folder',
    children: [
      { key: 'design', label: 'Design System' },
      { key: 'api', label: 'API Platform' },
    ],
  },
]" />

Grouped ​

group xususiyati yordamida elementlarni bo‘lim sarlavhalari ostida guruhlang.

vue
<VxSidebar v-model="active" :items="[
  { key: 'inbox', label: 'Inbox', icon: 'mail', group: 'Communication' },
  { key: 'chat', label: 'Chat', icon: 'heart', group: 'Communication' },
  { key: 'analytics', label: 'Analytics', icon: 'search', group: 'Workspace' },
]" />

Notification Dots ​

Elementlar ustidagi kichik rangli indikatorlar. Sukut bo‘yicha qizil, dotColor orqali sozlanadi.

vue
<VxSidebar v-model="active" :items="[
  { key: 'inbox', label: 'Inbox', icon: 'mail', dot: true },
  { key: 'chat', label: 'Chat', icon: 'heart', dot: true, dotColor: '#22c55e' },
]" />

Searchable ​

Elementlarni nomi bo‘yicha filtrlaydigan qidiruv maydonini qo‘shish uchun searchableni yoqing.

vue
<VxSidebar v-model="active" :items="items" searchable />
<VxSidebar v-model="active" :items="items" searchable search-placeholder="Find..." />

Collapsed ​

Faqat belgilar va tultiplarni ko‘rsatish uchun collapsedni almashtirib turing. Ichki menyular popout ko‘rinishida chiqadi.

vue
<script setup>
import { ref } from 'vue'

const active = ref('inbox')
const collapsed = ref(false)

const items = [
  { key: 'home', label: 'Home', icon: 'home' },
  { key: 'inbox', label: 'Inbox', icon: 'mail', badge: 5, badgeType: 'primary' },
  {
    key: 'projects',
    label: 'Projects',
    icon: 'folder',
    children: [
      { key: 'design', label: 'Design System' },
      { key: 'api', label: 'API Platform' },
      { key: 'mobile', label: 'Mobile App' },
    ],
  },
  {
    key: 'settings',
    label: 'Settings',
    icon: 'settings',
    children: [
      { key: 'profile', label: 'Profile', icon: 'user' },
      { key: 'security', label: 'Security', icon: 'link' },
      { key: 'billing', label: 'Billing' },
    ],
  },
  { key: 'logout', label: 'Log Out', icon: 'logout', divider: true },
]
</script>

<template>
  <VxButton @click="collapsed = !collapsed">
    {{ collapsed ? 'Expand' : 'Collapse' }}
  </VxButton>
  <VxSidebar v-model="active" :items="items" :collapsed="collapsed" />
</template>

Mini Mode ​

mini bilan yig‘ilganda, belgilar o‘rniga har bir nomning birinchi harfini ko‘rsatadi.

vue
<VxSidebar v-model="active" :items="items" collapsed mini />

Resizable ​

Yon panel chetini tortib o‘lchamini o‘zgartirishga ruxsat berish uchun resizableni yoqing. Yon panelning o‘ng chetini torting.

← drag the edge to resize
vue
<script setup>
import { ref } from 'vue'
import { VxSidebar } from 'veloxui'

const active = ref('inbox')
const collapsed = ref(false)

const items = [
  { key: 'inbox', label: 'Inbox', icon: 'mail' },
  { key: 'starred', label: 'Starred', icon: 'star' },
  { key: 'drafts', label: 'Drafts', icon: 'file' },
  { key: 'trash', label: 'Trash', icon: 'trash' },
]
</script>

<template>
  <VxSidebar
    v-model="active"
    v-model:collapsed="collapsed"
    :items="items"
    resizable
    :min-width="160"
    :max-width="360"
  />
</template>

Draggable ​

Yuqori darajadagi elementlarni drag and drop orqali tartibini o‘zgartirishga ruxsat berish uchun draggableni yoqing.

vue
<script setup>
import { ref } from 'vue'
import { VxSidebar } from 'veloxui'

const active = ref('inbox')
const items = ref([
  { key: 'inbox', label: 'Inbox', icon: 'mail' },
  { key: 'starred', label: 'Starred', icon: 'star' },
  { key: 'drafts', label: 'Drafts', icon: 'file' },
  { key: 'trash', label: 'Trash', icon: 'trash' },
  { key: 'settings', label: 'Settings', icon: 'settings' },
])

function onReorder(newItems) {
  items.value = newItems
}
</script>

<template>
  <VxSidebar v-model="active" :items="items" draggable @reorder="onReorder" />
</template>

Router Integration ​

SPA navigatsiyasi uchun elementlardagi to xususiyatidan foydalaning.

vue
<VxSidebar v-model="active" :items="[
  { key: 'home', label: 'Home', icon: 'home', to: '/' },
  { key: 'about', label: 'About', icon: 'user', to: '/about' },
]" />

Context Menu ​

Kontekst menyusini ko‘rish uchun "Inbox" yoki "Starred" ustiga o‘ng tugma bilan bosing.

vue
<script setup>
import { ref } from 'vue'
import { VxSidebar } from 'veloxui'

const active = ref('inbox')

const items = [
  {
    key: 'inbox',
    label: 'Inbox',
    icon: 'mail',
    badge: 5,
    badgeType: 'primary',
    contextMenu: [
      { label: 'Mark all read', icon: 'check', action: (item) => {} },
      { label: 'Settings', icon: 'settings', action: (item) => {} },
      { label: 'Delete all', icon: 'trash', destructive: true, action: (item) => {} },
    ],
  },
  {
    key: 'starred',
    label: 'Starred',
    icon: 'star',
    contextMenu: [
      { label: 'Clear starred', icon: 'x', action: (item) => {} },
    ],
  },
  { key: 'drafts', label: 'Drafts', icon: 'file' },
  { key: 'settings', label: 'Settings', icon: 'settings' },
]
</script>

<template>
  <VxSidebar v-model="active" :items="items" />
</template>

Loading ​

Ma’lumot yuklanayotgan paytda skeleton joy egallovchilarini ko‘rsating.

vue
<VxSidebar loading :loading-count="6" />

Dark Theme ​

vue
<VxSidebar v-model="active" :items="items" theme="dark" />

Accordion ​

Bir vaqtning o‘zida faqat bitta ichki menyuning ochiq turishiga ruxsat berish uchun accordionni o‘rnating. "Projects"ga, so‘ng "Settings"ga bosing — faqat bittasi ochiq qoladi.

vue
<script setup>
import { ref } from 'vue'
import { VxSidebar } from 'veloxui'

const active = ref('home')

const items = [
  { key: 'home', label: 'Home', icon: 'home' },
  {
    key: 'projects',
    label: 'Projects',
    icon: 'folder',
    children: [
      { key: 'design', label: 'Design System' },
      { key: 'api', label: 'API Platform' },
    ],
  },
  {
    key: 'settings',
    label: 'Settings',
    icon: 'settings',
    children: [
      { key: 'profile', label: 'Profile', icon: 'user' },
      { key: 'security', label: 'Security', icon: 'link' },
    ],
  },
  { key: 'logout', label: 'Log Out', icon: 'logout' },
]
</script>

<template>
  <VxSidebar v-model="active" :items="items" accordion />
</template>

API ​

VxSidebar Props ​

PropTypeDefaultDescription
itemsMenuItem[][]Yon panel elementlari
v-modelstring''Faol element kaliti
collapsedbooleanfalseFaqat belgilarga yig‘ish
theme'light' | 'dark''light'Rang mavzusi
accordionbooleanfalseBir vaqtning o‘zida faqat bitta ichki menyu ochiq
indentnumber24Ichki element chekinishi (px)
collapsed-widthnumber48Yig‘ilgandagi kengligi
widthnumber | string240Yon panel kengligi
roundedbooleantrueElement burchaklari yumaloq
searchablebooleanfalseQidiruv maydonini ko‘rsatish
search-placeholderstring'Search...'Qidiruv maydoni uchun placeholder
draggablebooleanfalseDrag & drop tartibini yoqish
minibooleanfalseYig‘ilganda birinchi harfni ko‘rsatish
resizablebooleanfalseO‘lcham tutqichini yoqish
min-widthnumber160O‘lcham o‘zgartirishdagi minimal kenglik
max-widthnumber400O‘lcham o‘zgartirishdagi maksimal kenglik
scroll-shadowbooleantrueScroll soyalarini ko‘rsatish
loadingbooleanfalseSkeleton joy egallovchilarini ko‘rsatish
loading-countnumber6Skeleton elementlar soni
root-classstring | string[] | object—Ildizdagi class
PropertyTypeRequiredDescription
keystringYesNoyob identifikator
labelstringYesKo‘rinadigan matn
iconstring | ComponentNoO‘rnatilgan belgi nomi yoki Vue komponenti
disabledbooleanNoBu elementni o‘chirish
badgestring | numberNoBelgi mazmuni
badgeType'default' | 'primary' | 'success' | 'warning' | 'danger'NoBelgi rangi
groupstringNoGuruh sarlavhasi nomi
dividerbooleanNoYuqorida ajratuvchi chiziqni ko‘rsatish
action(item) => voidNoBosilganda ishga tushuvchi callback
childrenMenuItem[]NoIchki menyu elementlari
tostring | objectNoVue Router navigatsiya maqsadi
dotbooleanNoBildirishnoma nuqtasini ko‘rsatish
dotColorstringNoNuqta rangi (sukut bo‘yicha qizil)
pinnedbooleanNoElementni tepada mahkamlash
contextMenuContextMenuItem[]NoO‘ng tugma menyu elementlari

Slots ​

SlotPropsDescription
header—Navigatsiya ustidagi kontent
footer—Navigatsiya ostidagi kontent
item{ item, active }Moslashtirilgan element renderi

Events ​

EventPayloadDescription
update:modelValue(key: string)Faol element o‘zgardi
update:collapsed(collapsed: boolean)min-width dan pastga o‘zgartirilganda avtomatik yig‘iladi
select(key, item)Element tanlandi
open-change(openKeys: string[])Ichki menyu ochildi/yopildi
search(query: string)Qidiruv maydoni o‘zgardi
reorder(items: MenuItem[])Elementlar drag orqali qayta tartiblandi
resize(width: number)Yon panel o‘lchami o‘zgartirildi
context-menu(item, event)Elementga o‘ng tugma bosildi
pin(item)Element mahkamlandi/bo‘shatildi

Exposed ​

NameTypeDescription
openKeys()() => string[]Hozirda ochiq bo‘lgan ichki menyu kalitlarini olish
toggleOpen(key)(key: string) => voidIchki menyuni almashtirish