Vue componentFree
Title
Adds headings such as h1, h2, and others. The heading level can be adjusted through properties.
v2.1.2Updated 10 months ago
Code
10 files in the repo<template>
<component
:is="tag"
:style="computedStyle"
@pointerenter="isHover = true"
@pointerleave="isHover = false"
>
<slot>
{{ tag.toUpperCase() }} Title
</slot>
</component>
</template>
<script>
import {
parse,
getStyle
} from '@componentor/adaptive';
export default {
wysiwyg: true,
inject: {
theme: {
default: ''
},
breakpoint: {
default: ''
}
},
data() {
return {
isHover: false
};
},
props: {
tag: {
type: String,
default: 'h1',
options: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
},
adapt: {
type: [String, Object, Array],
default: ''
},
state: {
type: [String, Array],
default: ''
},
themeName: {
type: String,
default: ''
},
breakpointName: {
type: String,
default: ''
},
breakpointStrategy: {
type: String,
default: 'mobile-first',
validator: v => ['exact', 'mobile-first', 'desktop-first'].includes(v)
},
themeStrategy: {
type: String,
default: 'fallback',
validator: v => ['strict', 'fallback'].includes(v)
}
},
computed: {
adaptString() {
if (!this.adapt) return '';
if (typeof this.adapt === 'string') return this.adapt;
if (Array.isArray(this.adapt)) {
return this.adapt.map(item => {
if (typeof item === 'string') return item;
return Object.entries(item)
.map(([key, value]) => `${key}:${value}`)
.join('; ');
})
.join('; ');
}
return Object.entries(this.adapt)
.map(([key, value]) => `${key}:${value}`)
.join('; ');
},
stateArray() {
const native = [];
if (this.isHover) native.push('hover');
if (!this.state) return native;
const custom = Array.isArray(this.state) ? this.state : this.state.split(':');
return [...native, ...custom];
},
computedStyle() {
if (!this.adaptString) return '';
const parsed = parse(this.adaptString);
return getStyle(parsed, {
theme: this.themeName || this.theme,
breakpoint: this.breakpointName || this.breakpoint,
states: this.stateArray,
breakpointStrategy: this.breakpointStrategy,
themeStrategy: this.themeStrategy
});
}
}
};
</script>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| tag | String | 'h1' | — |
| adapt | String | Object | Array | '' | — |
| state | String | Array | '' | — |
| themeName | String | '' | — |
| breakpointName | String | '' | — |
| breakpointStrategy | String | 'mobile-first' | — |
| themeStrategy | String | 'fallback' | — |
Related components
All typography →Component · Hero sections
Hero Split
Split Vue 3 hero section with copy and two CTAs on the left and a Tailwind-drawn app window mockup on the right. Dark mode, typed props, no images.
by Vueplay1 installs
Component · Feature sections
Bento Grid
Bento-style Vue 3 feature grid with wide and tall tiles and small CSS-drawn visuals like maps, timelines and code. Tailwind CSS, dark mode, typed tiles.
by Vueplay
Component · Layout