Nuxt UI v3-alpha has been released!

Try it out

Aside

A sticky <aside> with customizable slots and anchors.

Usage

The Aside component will instantiate a sticky <aside> element, displayed only after the lg breakpoint with a min-height based on the --header-height variable.

Use the links prop to display a list of links at the top of the Aside and the #top or #bottom slots to display content above or below the links.

<script setup lang="ts">
const links = [{
  label: 'Documentation',
  icon: 'i-heroicons-book-open',
  to: '/getting-started'
}, {
  label: 'Playground',
  icon: 'i-simple-icons-stackblitz',
  to: '/playground'
}, {
  label: 'Roadmap',
  icon: 'i-heroicons-map',
  to: '/roadmap'
}, {
  label: 'Pro',
  icon: 'i-heroicons-square-3-stack-3d',
  to: '/pro'
}, {
  label: 'Releases',
  icon: 'i-heroicons-rocket-launch',
  to: 'https://github.com/nuxt/ui/releases',
  target: '_blank'
}]

const pageLinks = [{
  icon: 'i-heroicons-heart',
  label: 'Learn how to contribute',
  to: '/getting-started/contributing',
  target: '_blank'
}]
</script>

<template>
  <UAside :links="links">
    <template #top>
      <UContentSearchButton />
    </template>

    <Placeholder class="h-60" />

    <template #bottom>
      <UDivider type="dashed" class="my-6" />

      <UPageLinks :links="pageLinks" />
    </template>
  </UAside>
</template>

You'll usually use this component in the #left slot of a Page with a NavigationTree inside.

layouts/docs.vue
<template>
  <UContainer>
    <UPage>
      <template #left>
        <UAside :links="links">
          <UNavigationTree :links="navigationLinks" default-open :multiple="false" />
        </UAside>
      </template>

      <slot />
    </UPage>
  </UContainer>
</template>

Slots

top
{}
links
{}
default
{}
bottom
{}

Props

ui
DeepPartial<{ wrapper: string; top: { wrapper: string; header: string; body: string; footer: string; }; }>
{}
links
AsideLink[]
[]

Config

{
  wrapper: 'hidden overflow-y-auto lg:block lg:max-h-[calc(100vh-var(--header-height))] lg:sticky lg:top-[--header-height] py-8 lg:px-4 lg:-mx-4',
  top: {
    wrapper: 'sticky -top-8 -mt-8 pointer-events-none z-[1]',
    header: 'h-8 bg-background -mx-4 px-4',
    body: 'bg-background relative pointer-events-auto flex -mx-4 px-4',
    footer: 'h-8 bg-gradient-to-b from-background -mx-4 px-4'
  }
}