<c-side-navigation>
Examples
<template>
<div>
<c-side-navigation>
<c-side-navigation-title>My project</c-side-navigation-title>
<c-side-navigation-item
:active.prop="current === 'dashboard'"
@item-change="current = 'dashboard'"
>
<c-icon :path="mdiViewDashboardOutline" />
Dashboard
</c-side-navigation-item>
<c-side-navigation-item active>
<c-icon :path="mdiFolderOutline" />
Projects
<c-sub-navigation-item
:active.prop="current === 'active'"
@click="current = 'active'"
@keyup.enter="current = 'active'"
>
Active projects
</c-sub-navigation-item>
<c-sub-navigation-item
:active.prop="current === 'archived'"
@click="current = 'archived'"
@keyup.enter="current = 'archived'"
>
Archived projects
</c-sub-navigation-item>
</c-side-navigation-item>
<c-side-navigation-item href="https://csc.fi" target="_blank">
<c-icon :path="mdiOpenInNew" />
Service description
</c-side-navigation-item>
</c-side-navigation>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import {
mdiFolderOutline,
mdiOpenInNew,
mdiViewDashboardOutline,
} from '@mdi/js';
const current = ref('active');
</script>
<template>
<div>
<c-side-navigation>
<c-side-navigation-item
:active.prop="current === 'dashboard'"
@item-change="current = 'dashboard'"
>
<c-icon :path="mdiViewDashboardOutline" />
Dashboard
</c-side-navigation-item>
<c-side-navigation-item active>
<c-icon :path="mdiFolderOutline" />
Projects
<c-sub-navigation-item
:active.prop="current === 'active'"
@click="current = 'active'"
@keyup.enter="current = 'active'"
>
Active projects
</c-sub-navigation-item>
<c-sub-navigation-item
:active.prop="current === 'archived'"
@click="current = 'archived'"
@keyup.enter="current = 'archived'"
>
Archived projects
</c-sub-navigation-item>
</c-side-navigation-item>
<c-side-navigation-item href="https://csc.fi" target="_blank">
<c-icon :path="mdiOpenInNew" />
Service description
</c-side-navigation-item>
</c-side-navigation>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import {
mdiFolderOutline,
mdiOpenInNew,
mdiViewDashboardOutline,
} from '@mdi/js';
const current = ref('dashboard');
</script>
<template>
<div>
<c-side-navigation>
<c-side-navigation-title>Services</c-side-navigation-title>
<c-side-navigation-item>
<c-icon :path="mdiDatabaseOutline" />
Data storage
</c-side-navigation-item>
<c-side-navigation-item>
<c-icon :path="mdiServerNetwork" />
Computing
</c-side-navigation-item>
<c-side-navigation-title>Support</c-side-navigation-title>
<c-side-navigation-item>
<c-icon :path="mdiHelpCircleOutline" />
User guides
</c-side-navigation-item>
</c-side-navigation>
</div>
</template>
<script setup lang="ts">
import {
mdiDatabaseOutline,
mdiHelpCircleOutline,
mdiServerNetwork,
} from '@mdi/js';
</script>
<template>
<div>
<c-side-navigation>
<c-side-navigation-item active>
<c-icon :path="mdiFolderOutline" />
Projects
<c-sub-navigation-item
:active.prop="current === 'active'"
@click="current = 'active'"
@keyup.enter="current = 'active'"
>
Active projects
</c-sub-navigation-item>
<c-sub-navigation-item
:active.prop="current === 'archived'"
@click="current = 'archived'"
@keyup.enter="current = 'archived'"
>
Archived projects
</c-sub-navigation-item>
<c-sub-navigation-item href="https://csc.fi" target="_blank">
Service description
</c-sub-navigation-item>
</c-side-navigation-item>
</c-side-navigation>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { mdiFolderOutline } from '@mdi/js';
const current = ref('active');
</script>
API reference
<c-side-navigation>
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
menuVisible | menu-visible | boolean | false | Mobile version menu visibility |
mobile | mobile | boolean | false | Mobile version |
styles | — | null | Record<string, string> | null | Background styles |
Events
| Event | Detail | Description |
|---|---|---|
change:menu-visible | boolean | Fired when the drawer is closed from within (the mobile close button or the backdrop overlay), carrying the new visibility (`false`). Named `change:menu-visible`, not `update:menuVisible`: Vue's runtime silently drops `onUpdate:*` listeners on custom elements (`isModelListener`), so a template `@update:menu-visible` would never be attached. |
Slots
| Slot | Description |
|---|---|
default | Default slot |
bottom | Place items at the bottom |
CSS parts
Style from outside with c-side-navigation::part(name) — parts are the library's only styling customization API.
| Part | Description |
|---|---|
root | The outer drawer container |
nav | The scrollable `<nav>` element holding the navigation items |
<c-side-navigation-item>
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
active | active | boolean | false | Indicate active state |
focusable | focusable | boolean | true | Whether the item is in the keyboard tab order — a parent item sets this to false on its collapsed sub-items so hidden items aren't Tab-reachable |
href | href | string | '' | Hyperlink url |
loading | loading | boolean | false | Loading state |
target | target | string | '' | Hyperlink target |
Events
| Event | Detail | Description |
|---|---|---|
itemChange | Event | Fired when the item is activated (click or Enter), carrying the originating DOM event; bubbles so the parent `<c-side-navigation>` can coordinate which item is active. Also dispatched as `item-change` — bind that name in Vue templates. |
Slots
| Slot | Description |
|---|---|
default | The item's label content (text and an optional c-icon) |
sub-item | Nested c-side-navigation-item components; assigned automatically to nested items |
CSS parts
Style from outside with c-side-navigation-item::part(name) — parts are the library's only styling customization API.
| Part | Description |
|---|---|
root | The outer box wrapping the header and sub-navigation, carrying the background and state styling |
header | The clickable header row (an `<a>` when `href` is set) holding the chevron and label |
sub-nav | The collapsible `<nav>` container for the sub-items |
<c-side-navigation-title>
Slots
| Slot | Description |
|---|---|
default | The title text of the navigation section |
CSS parts
Style from outside with c-side-navigation-title::part(name) — parts are the library's only styling customization API.
| Part | Description |
|---|---|
root | The outer wrapper around the label and the divider |
label | The uppercase section title label |
divider-root | The underline divider's root element, forwarded from the inner c-divider |
<c-sub-navigation-item>
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
active | active | boolean | false | Active state |
focusable | focusable | boolean | false | Element is visible and focusable |
href | href | string | '' | Link url |
loading | loading | boolean | false | Loading state |
target | target | string | '' | Link target |
Slots
| Slot | Description |
|---|---|
default | The visible content of the navigation item |
CSS parts
Style from outside with c-sub-navigation-item::part(name) — parts are the library's only styling customization API.
| Part | Description |
|---|---|
root | The focusable menu-item row carrying the hover/active styling and the leading indicator |
content | Wrapper around the slotted content inside the row |