---
title: "PageLinks"
description: "Список ссылок для показа на странице."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/page-links"
---
# PageLinks

> Список ссылок для показа на странице.

## Использование

### Ссылки

Пропс `links` — массив объектов со свойствами:

- `label: string`
- `icon?: IconComponent`
- `class?: any`
- `b24ui?: { item?: ClassNameValue, link?: ClassNameValue, linkLabel?: ClassNameValue, linkLabelExternalIcon?: ClassNameValue, linkLeadingIcon?: ClassNameValue }`

Можно передать любое свойство компонента [Link](https://b24-ui.bx-shef.by/raw/docs/components/link.md#props), например `to`, `target` и другие.

```vue
<script setup lang="ts">
import type { PageLink } from '@bxshefby/b24ui-nuxt'

const links = ref<PageLink[]>([
  {
    label: 'Редактировать страницу',
    to: 'https://github.com/bitrix24/b24ui/blob/main/docs/content/docs/2.components/page-links.md'
  },
  {
    label: 'Поставить звезду на GitHub',
    to: 'https://github.com/bitrix24/b24ui'
  },
  {
    label: 'Релизы',
    to: 'https://github.com/bitrix24/b24ui/releases'
  }
])
</script>

<template>
  <B24PageLinks :links="links" />
</template>
```

### Заголовок

Пропс `title` показывает заголовок над ссылками.

```vue
<script setup lang="ts">
import type { PageLink } from '@bxshefby/b24ui-nuxt'

const links = ref<PageLink[]>([
  {
    label: 'Редактировать страницу',
    to: 'https://github.com/bitrix24/b24ui/blob/main/docs/content/docs/2.components/page-links.md'
  },
  {
    label: 'Поставить звезду на GitHub',
    to: 'https://github.com/bitrix24/b24ui'
  },
  {
    label: 'Релизы',
    to: 'https://github.com/bitrix24/b24ui/releases'
  }
])
</script>

<template>
  <B24PageLinks title="Сообщество" :links="links" />
</template>
```

## Примеры

> [!NOTE]
> В примерах используется [Nuxt Content](https://content.nuxt.com), но компоненты можно подключить к любой системе управления контентом.

### На странице

Используйте PageLinks в слоте `bottom` компонента ContentToc, чтобы показать список ссылок под оглавлением.

```vue [pages/[...slug].vue]
<script setup lang="ts">
import type { PageLink } from '@bxshefby/b24ui-nuxt'
import DocumentSignIcon from '@bitrix24/b24icons-vue/main/DocumentSignIcon'
import AiStarsIcon from '@bitrix24/b24icons-vue/outline/AiStarsIcon'
import RocketIcon from '@bitrix24/b24icons-vue/outline/RocketIcon'

const route = useRoute()

definePageMeta({
  layout: 'docs'
})

const { data: page } = await useAsyncData(route.path, () => {
  return queryCollection('docs').path(route.path).first()
})

const { data: surround } = await useAsyncData(`${route.path}-surround`, () => {
  return queryCollectionItemSurroundings('content', route.path)
})

const links = computed<PageLink[]>(() => [{
  label: 'Edit this page',
  icon: DocumentSignIcon,
  to: `https://github.com/bitrix24/b24ui/blob/main/docs/content/docs/2.components/${page?.value?.stem}.md`,
  target: '_blank'
}, {
  label: 'Star on GitHub',
  icon: AiStarsIcon,
  to: 'https://github.com/bitrix24/b24ui',
  target: '_blank'
}, {
  label: 'Releases',
  icon: RocketIcon,
  to: 'https://github.com/bitrix24/b24ui/releases'
}])
</script>

<template>
  <div>
    <div>
      <ContentRenderer :value="page" />

      <B24Separator />

      <B24ContentSurround :surround="surround" />
    </div>

    <div>
      <B24ContentToc :links="page.body.toc.links">
        <template #bottom>
          <B24Separator type="dashed" />

          <B24PageLinks title="Community" :links="links" />
        </template>
      </B24ContentToc>
    </div>
  </div>
</template>
```

## API

### Пропсы

```ts
/**
 * Props for the PageLinks component
 */
interface PageLinksProps {
  /**
   * The element or component this component should render as.
   * @default 'nav'
   */
  as?: any;
  title?: string | undefined;
  links?: T[] | undefined;
  b24ui?: { root?: SlotClass; title?: SlotClass; list?: SlotClass; item?: SlotClass; link?: SlotClass; linkWrapper?: SlotClass; linkLeadingIcon?: SlotClass; linkLabel?: SlotClass; linkLabelExternalIcon?: SlotClass; } | undefined;
}
```

### Слоты

```ts
/**
 * Slots for the PageLinks component
 */
interface PageLinksSlots {
  title(): any;
  link(): any;
  link-leading(): any;
  link-label(): any;
  link-trailing(): any;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    pageLinks: {
      slots: {
        root: 'flex flex-col gap-[12px]',
        title: 'text-legend text-(length:--ui-font-size-md) leading-(--ui-font-line-height-md) font-(--ui-font-weight-semi-bold) flex items-center gap-[6px]',
        list: 'flex flex-col gap-2',
        item: 'relative',
        link: 'group text-(length:--ui-font-size-sm) cursor-pointer focus-visible:outline-(--ui-color-design-outline-focused-stroke) focus-visible:outline-1 focus-visible:rounded-[4px] text-start text-(--ui-color-design-selection-content) underline-offset-2 hover:text-(--ui-color-accent-main-primary-alt-2) hover:underline flex flex-row items-center justify-between',
        linkWrapper: 'flex items-center gap-[6px]',
        linkLeadingIcon: 'size-5 shrink-0',
        linkLabel: 'truncate',
        linkLabelExternalIcon: 'size-4 text-(--ui-color-design-selection-content) group-hover:text-(--ui-color-accent-main-primary-alt-2)'
      },
      variants: {
        active: {
          true: {
            link: 'text-(--ui-color-accent-main-primary-alt-2)',
            linkLabelExternalIcon: 'text-(--ui-color-accent-main-primary-alt-2)'
          },
          false: {
            link: [
              'text-(--ui-color-design-selection-content) hover:text-(--ui-color-accent-main-primary-alt-2)'
            ]
          }
        }
      }
    }
  }
})
```

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
