ページ別

ページナビゲーションを表示するための付箋脇。

使用法

PageAsideコンポーネントは、lgブレークポイントからのみ表示されるスティッキーな<aside>要素です。

PageAsideコンポーネントはCSS変数--ui-header-heightを使用してHeaderの下に正しく位置します。

Pageコンポーネントのleftまたはrightスロット内で使用します。

<template>
  <UPage>
    <template #left>
      <UPageAside />
    </template>
  </UPage>
</template>

例

これらの例はNuxt Contentを使用していますが、コンポーネントは任意のコンテンツ管理システムと統合できます。

レイアウト内

レイアウトでPageAsideコンポーネントを使用してナビゲーションを表示します。

layouts/docs.vue
<script setup lang="ts">
import type { ContentNavigationItem } from '@nuxt/content'

const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
</script>

<template>
  <UPage>
    <template #left>
      <UPageAside>
        <UContentNavigation :navigation="navigation" />
      </UPageAside>
    </template>

    <slot />
  </UPage>
</template>
この例では、ContentNavigationコンポーネントを使用して、app.vueに注入されたナビゲーションを表示します。

API

Props

Prop Default Type
as
'aside'
any

The element or component this component should render as.

ui
{ root?: SlotClass; container?: SlotClass; top?: SlotClass; topHeader?: SlotClass; topBody?: SlotClass; topFooter?: SlotClass; }

スロット

Slot Type
top
{}
default
{}
bottom
{}

Theme

app.config.ts
export default defineAppConfig({
  ui: {
    pageAside: {
      slots: {
        root: 'hidden overflow-y-auto lg:block lg:max-h-[calc(100vh-var(--ui-header-height))] lg:sticky lg:top-(--ui-header-height) py-8 lg:ps-4 lg:-ms-4 lg:pe-6.5',
        container: 'relative',
        top: 'sticky -top-8 -mt-8 pointer-events-none z-[1]',
        topHeader: 'h-8 bg-default -mx-4 px-4',
        topBody: 'bg-default relative pointer-events-auto flex flex-col -mx-4 px-4',
        topFooter: 'h-8 bg-gradient-to-b from-default -mx-4 px-4'
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'

export default defineConfig({
  plugins: [
    vue(),
    ui({
      ui: {
        pageAside: {
          slots: {
            root: 'hidden overflow-y-auto lg:block lg:max-h-[calc(100vh-var(--ui-header-height))] lg:sticky lg:top-(--ui-header-height) py-8 lg:ps-4 lg:-ms-4 lg:pe-6.5',
            container: 'relative',
            top: 'sticky -top-8 -mt-8 pointer-events-none z-[1]',
            topHeader: 'h-8 bg-default -mx-4 px-4',
            topBody: 'bg-default relative pointer-events-auto flex flex-col -mx-4 px-4',
            topFooter: 'h-8 bg-gradient-to-b from-default -mx-4 px-4'
          }
        }
      }
    })
  ]
})

Changelog

No recent changes