primevue-mirror/doc/accordion/theming/TailwindDoc.vue

98 lines
4.9 KiB
Vue
Raw Normal View History

<template>
<DocSectionText v-bind="$attrs">
<p>
PrimeVue offers a built-in Tailwind theme to get you started quickly. The default values related to the component are displayed below. The component can easily be styled with your own design based on Tailwind utilities, see the
2023-08-07 12:40:22 +00:00
<PrimeVueNuxtLink to="/tailwind">Tailwind Customization</PrimeVueNuxtLink> section for an example.
</p>
2023-09-22 12:54:14 +00:00
<DocSectionCode :code="code1" hideToggleCode importCode hideCodeSandbox scrollable />
2023-08-16 13:58:31 +00:00
<p class="mt-4">A playground sample with the pre-built Tailwind theme.</p>
<DocSectionCode :code="code2" embedded />
</DocSectionText>
</template>
<script>
export default {
data() {
return {
code1: {
2023-08-16 13:58:31 +00:00
basic: `export const TRANSITIONS = {
toggleable: {
enterFromClass: 'max-h-0',
enterActiveClass: 'overflow-hidden transition-all duration-500 ease-in-out',
enterToClass: 'max-h-40 ',
leaveFromClass: 'max-h-40',
leaveActiveClass: 'overflow-hidden transition-all duration-500 ease-in',
leaveToClass: 'max-h-0'
}
};
export default {
accordion: {
root: 'mb-1',
accordiontab: {
root: 'mb-1',
header: ({ props }) => ({
class: [
{ 'select-none pointer-events-none cursor-default opacity-60': props?.disabled } // Condition
]
}),
headerAction: ({ context }) => ({
class: [
'flex items-center cursor-pointer relative no-underline select-none', // Alignments
'p-5 transition duration-200 ease-in-out rounded-t-md font-bold transition-shadow duration-200', // Padding and transition
'border border-gray-300 bg-gray-100 text-gray-600', // Borders and colors
'dark:bg-gray-900 dark:border-blue-900/40 dark:text-white/80 dark:hover:bg-gray-800/80 dark:focus:shadow-[inset_0_0_0_0.2rem_rgba(147,197,253,0.5)]', // Dark mode
'hover:border-gray-300 hover:bg-gray-200 hover:text-gray-800', // Hover
'focus:outline-none focus:outline-offset-0 focus:shadow-[inset_0_0_0_0.2rem_rgba(191,219,254,1)]', // Focus
{ 'rounded-br-md rounded-bl-md': !context.active, 'rounded-br-0 rounded-bl-0 text-gray-800': context.active } // Condition
]
}),
headerIcon: 'inline-block mr-2',
headerTitle: 'leading-none',
content: {
class: [
'p-5 border border-gray-300 bg-white text-gray-700 border-t-0 rounded-tl-none rounded-tr-none rounded-br-lg rounded-bl-lg',
'dark:bg-gray-900 dark:border-blue-900/40 dark:text-white/80' // Dark mode
]
},
transition: TRANSITIONS.toggleable
}
}
}
`
},
code2: {
2023-09-22 12:54:14 +00:00
composition: `
<template>
<div class="card">
<Accordion :activeIndex="0">
<AccordionTab header="Header I">
<p>
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>
</AccordionTab>
<AccordionTab header="Header II">
<p>
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim
ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Consectetur, adipisci velit, sed quia non numquam eius modi.
</p>
</AccordionTab>
<AccordionTab header="Header III">
<p>
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui
officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus.
</p>
</AccordionTab>
</Accordion>
</div>
</template>
<script setup>
<\/script>`
}
};
}
};
</script>