Skip to content

SLocalNav

<SLocalNav> determines the top level navigation for a specific page.

Import

ts
import SLocalNav from '@globalbrain/sefirot/lib/components/SLocalNav.vue'

Usage

The only required props is :title. The most basic local nav that contains only the title can be defined as follows.

The :title prop accepts array of title object. This is because title could have link, and also it can be a breadcrumb as shown at later section.

vue
<script setup lang="ts">
const title = [
  { text: 'Page title' }
]
</script>

<template>
  <SLocalNav :title="title" />
</template>

You may pass multiple title objects as an array to :title prop to render breadcrumbs. Usually, except for the latest one, each title object should have link set.

vue
<script setup lang="ts">
const title = [
  { text: 'Parent page', link: '/parent' },
  { text: 'Current page' }
]
</script>

<template>
  <SLocalNav :title="title" />
</template>

You may define :menu to display a page navigation. The :menu props accepts "double nested" array, in order to create grouping of menu items.

vue
<script setup lang="ts">
const title = [
  { text: 'Page title' },
]

const menu = [
  [
    { text: 'Menu item 1', link: '/menu1' },
    { text: 'Menu item 2', link: '/menu2' },
  ],
  [
    { text: 'Menu item 3', link: '/menu3' },
    { text: 'Menu item 4', link: '/menu4' },
  ],
]
</script>

<template>
  <SLocalNav :title="title" :menu="menu" />
</template>

Types

Title

The type of the :title prop.

ts
interface Title {
  text: string
  link?: string
}

The type of menu item.

ts
import { type IconifyIcon } from '@iconify/vue/dist/offline'

interface MenuItem {
  icon?: IconifyIcon
  text: string
  link: string
  active?: boolean
}

Props

ts
interface Props {
  title: Title[]
  menu?: MenuItem[][]
}

:title

The title of the page.

ts
interface Props {
  title: Title[]
}
template
<SLocalNav :title="[{ text: 'Page title' }]" />

The menu of the page.

ts
interface Props {
  menu: MenuItem[][]
}
template
<SLocalNav :title="[{ text: 'Page title' }]" />