Skip to content

useContentHeadline

Introduction

TIP

Optionally, the component <ContentHeadline> can also be used as a wrapper.

useContentHeadline() is used to display the headline structure.

Example: h1, h2, h3, h4, h5, h6

The level of the heading is taken from useContentContainer() or ContentContainer.

The deeper the nesting, the smaller the heading.

vue
<template>
  <component :is="currentTag">
    <slot />
  </component>
</template>

<script setup>
import { useContentHeadline } from 'vue-semantic-structure';

const { currentTag } = useContentHeadline();
</script>

Types

ts
declare function useContentHeadline(options?: ContentHeadlineOptions): ContentHeadlineReturn;

declare interface ContentHeadlineOptions {
  tag?: string;
}

declare interface ContentHeadlineReturn {
  parentLevel: ComputedRef<number>;
  currentLevel: ComputedRef<number>;
  currentTag: ComputedRef<string>;
}

Options

PropertyTypeDescriptionDefault Value
tagString|undefinedTag for the elementundefined

Result

PropertyTypeDescription
parentLevelComputedRef<Number>;Get parent level.
currentLevelComputedRef<Number>Get current level.
currentTagComputedRef<String>Get current html tag.