primevue-mirror/doc/passthrough/BasicDoc.vue

145 lines
6.8 KiB
Vue
Raw Normal View History

2023-07-09 21:13:49 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>
2023-07-11 23:14:34 +00:00
Each component has a special <i>pt</i> property to define an object with keys corresponding to the available DOM elements. Each value can either be a string, an object or a function that returns a string or an object to define the
arbitrary properties to apply to the element such as styling, aria, data-* or custom attributes. If the value is a string or a function that returns a string, it is considered as a class definition and added to the class attribute of the
element. Every component documentation has a dedicated section to document the available section names exposed via PT.
2023-07-09 21:13:49 +00:00
</p>
2023-08-01 13:53:05 +00:00
<p>
Most common usage of <i>pt</i> is styling and customization. The <i>class</i> and <i>style</i> properties support the exact syntax of the corresponding
<a href="https://vuejs.org/guide/essentials/class-and-style.html">Vue bindings</a> like arrays, objects and conditionals. example below styles a Panel component with PrimeFlex CSS library.
</p>
2023-07-09 21:13:49 +00:00
</DocSectionText>
<div class="card">
<Panel
header="Header"
toggleable
:pt="{
2023-07-11 11:11:42 +00:00
header: (options) => ({
2023-07-11 23:14:34 +00:00
id: 'myPanelHeader',
style: {
'user-select': 'none'
},
2023-07-11 11:11:42 +00:00
class: [
'border-primary',
{
'bg-primary': options.state.d_collapsed,
'bg-primary-reverse': !options.state.d_collapsed
}
]
}),
2023-07-09 21:13:49 +00:00
content: { class: 'border-primary text-lg text-primary-700' },
2023-07-11 23:14:34 +00:00
title: 'text-xl',
toggler: () => 'bg-primary hover:bg-primary-reverse'
2023-07-09 21:13:49 +00:00
}"
>
<p class="m-0">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</Panel>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
code: {
basic: `
<Panel header="Header" toggleable
:pt="{
2023-07-11 11:11:42 +00:00
header: (options) => ({
2023-07-11 23:14:34 +00:00
id: 'myPanelHeader',
style: {
'user-select': 'none'
},
2023-07-11 11:11:42 +00:00
class: [
'border-primary',
{
'bg-primary': options.state.d_collapsed,
2023-07-11 11:16:59 +00:00
'bg-primary-reverse': !options.state.d_collapsed
}
]
2023-07-11 11:11:42 +00:00
}),
2023-07-09 21:13:49 +00:00
content: { class: 'border-primary text-lg text-primary-700' },
2023-07-11 23:14:34 +00:00
title: 'text-xl', // OR { class: 'text-xl' }
toggler: () => 'bg-primary hover:bg-primary-reverse' // OR { class: 'bg-primary hover:bg-primary-reverse' }
2023-07-09 21:13:49 +00:00
}">
<p class="m-0">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</Panel>`,
options: `
<template>
<div class="card">
<Panel header="Header" toggleable
:pt="{
2023-07-11 11:11:42 +00:00
header: (options) => ({
2023-07-11 23:14:34 +00:00
id: 'myPanelHeader',
style: {
'user-select': 'none'
},
2023-07-11 11:11:42 +00:00
class: [
'border-primary',
{
'bg-primary': options.state.d_collapsed,
2023-07-11 11:16:59 +00:00
'bg-primary-reverse': !options.state.d_collapsed
}
]
2023-07-11 11:11:42 +00:00
}),
2023-07-09 21:13:49 +00:00
content: { class: 'border-primary text-lg text-primary-700' },
2023-07-11 23:14:34 +00:00
title: 'text-xl', // OR { class: 'text-xl' }
toggler: () => 'bg-primary hover:bg-primary-reverse' // OR { class: 'bg-primary hover:bg-primary-reverse' }
2023-07-09 21:13:49 +00:00
}">
<p class="m-0">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</Panel>
</div>
</template>
<script>
<\/script>`,
composition: `
<template>
<div class="card">
<Panel header="Header" toggleable
:pt="{
2023-07-11 11:11:42 +00:00
header: (options) => ({
2023-07-11 23:14:34 +00:00
id: 'myPanelHeader',
style: {
'user-select': 'none'
},
2023-07-11 11:11:42 +00:00
class: [
'border-primary',
{
'bg-primary': options.state.d_collapsed,
2023-07-11 11:16:59 +00:00
'bg-primary-reverse': !options.state.d_collapsed
}
]
2023-07-11 11:11:42 +00:00
}),
2023-07-09 21:13:49 +00:00
content: { class: 'border-primary text-lg text-primary-700' },
2023-07-11 23:14:34 +00:00
title: 'text-xl', // OR { class: 'text-xl' }
toggler: () => 'bg-primary hover:bg-primary-reverse' // OR { class: 'bg-primary hover:bg-primary-reverse' }
2023-07-09 21:13:49 +00:00
}">
<p class="m-0">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</Panel>
</div>
</template>
<script setup>
<\/script>`
}
};
}
};
</script>