primevue-mirror/apps/showcase/doc/passthrough/BasicDoc.vue

148 lines
7.2 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
2023-09-09 23:25:16 +00:00
<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.
2023-08-01 13:53:05 +00:00
</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',
{
2024-05-20 12:14:38 +00:00
'bg-primary text-primary-contrast': options.state.d_collapsed,
'text-primary bg-primary-contrast': !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',
2024-05-20 12:14:38 +00:00
toggler: () => 'bg-primary text-primary-contrast hover:text-primary hover:bg-primary-contrast'
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: {
2023-09-22 12:54:14 +00:00
basic: `
<Panel header="Header" toggleable
2023-07-09 21:13:49 +00:00
: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',
{
2024-05-20 12:14:38 +00:00
'bg-primary text-primary-contrast': options.state.d_collapsed,
'text-primary bg-primary-contrast': !options.state.d_collapsed
2023-07-11 11:16:59 +00:00
}
]
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' }
2024-05-20 12:14:38 +00:00
toggler: () => 'bg-primary text-primary-contrast hover:text-primary hover:bg-primary-contrast' // OR { class: 'bg-primary text-primary-contrast hover:text-primary hover:bg-primary-contrast' }
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>
2023-10-15 09:38:39 +00:00
</Panel>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-07-09 21:13:49 +00:00
<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',
{
2024-05-20 12:14:38 +00:00
'bg-primary text-primary-contrast': options.state.d_collapsed,
'text-primary bg-primary-contrast': !options.state.d_collapsed
2023-07-11 11:16:59 +00:00
}
]
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' }
2024-05-20 12:14:38 +00:00
toggler: () => 'bg-primary text-primary-contrast hover:text-primary hover:bg-primary-contrast' // OR { class: 'bg-primary text-primary-contrast hover:text-primary hover:bg-primary-contrast' }
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>
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-07-09 21:13:49 +00:00
<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',
{
2024-05-20 12:14:38 +00:00
'bg-primary text-primary-contrast': options.state.d_collapsed,
'text-primary bg-primary-contrast': !options.state.d_collapsed
2023-07-11 11:16:59 +00:00
}
]
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' }
2024-05-20 12:14:38 +00:00
toggler: () => 'bg-primary text-primary-contrast hover:text-primary hover:bg-primary-contrast' // OR { class: 'bg-primary text-primary-contrast hover:text-primary hover:bg-primary-contrast' }
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>
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-07-09 21:13:49 +00:00
}
};
}
};
</script>