Component · Typography
Title
Adds headings such as h1, h2, and others. The heading level can be adjusted through properties.
Adds text elements with customizable styles.
v2.1.2Updated 10 months ago
<template>
<component
:is="tag"
:style="computedStyle"
@pointerenter="isHover = true"
@pointerleave="isHover = false; isActive = false"
@pointerdown="isActive = true"
@pointerup="isActive = false"
@pointercancel="isActive = false"
@focus="isFocus = true"
@blur="isFocus = false"
@focusin="isFocusWithin = true"
@focusout="isFocusWithin = false"
>
<slot>
Text
</slot>
</component>
</template>
<script>
import {
parse,
getStyle
} from '@componentor/adaptive';
export default {
wysiwyg: true,
inject: {
theme: {
default: ''
},
breakpoint: {
default: ''
}
},
data() {
return {
isHover: false,
isActive: false,
isFocus: false,
isFocusWithin: false
};
},
props: {
tag: {
type: String,
default: 'span'
},
adapt: {
type: [String, Object, Array],
default: ''
},
state: {
type: [String, Array],
default: ''
},
disabled: {
type: Boolean,
default: false
},
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.isActive) native.push('active');
if (this.isFocus) native.push('focus');
if (this.isFocusWithin) native.push('focus-within');
if (this.disabled) native.push('disabled');
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>| Prop | Type | Default | Description |
|---|---|---|---|
| tag | String | 'span' | — |
| adapt | String | Object | Array | '' | — |
| state | String | Array | '' | — |
| disabled | Boolean | false | — |
| themeName | String | '' | — |
| breakpointName | String | '' | — |
| breakpointStrategy | String | 'mobile-first' | — |
| themeStrategy | String | 'fallback' | — |
Component · Typography
Adds headings such as h1, h2, and others. The heading level can be adjusted through properties.
Component · Hero sections
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.
Component · Feature sections
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.
Component · Layout