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

208 lines
6.4 KiB
Vue
Raw Normal View History

<template>
<DocSectionText v-bind="$attrs">
2023-08-07 11:27:39 +00:00
<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
<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 hideStackBlitz scrollable />
2023-08-16 13:58:31 +00:00
<p class="mt-4">A playground sample with the pre-built Tailwind theme.</p>
2023-08-07 11:27:39 +00:00
<DocSectionCode :code="code2" embedded />
</DocSectionText>
</template>
<script>
export default {
data() {
return {
2023-08-07 11:27:39 +00:00
code1: {
2023-10-15 09:38:39 +00:00
basic: `
export const TRANSITIONS = {
2023-08-07 11:27:39 +00:00
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 {
panelmenu: {
root: 'w-full md:w-[25rem]',
panel: 'mb-1',
header: {
class: [
'outline-none',
'focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]' // Focus
]
},
headercontent: {
class: [
'border border-solid border-gray-300 dark:border-blue-900/40 text-gray-700 dark:text-white/80 bg-gray-100 dark:bg-gray-900 rounded-md transition-shadow duration-200',
'hover:bg-gray-200 dark:hover:bg-gray-800/80 hover:text-gray-700 dark:hover:text-white/80'
]
},
headeraction: {
class: ['flex items-center select-none cursor-pointer relative no-underline', 'text-gray-700 dark:text-white/80 p-5 font-bold']
},
submenuicon: 'mr-2',
headericon: 'mr-2',
menucontent: 'py-1 border border-t-0 border-gray-300 dark:border-blue-900/40 bg-white dark:bg-gray-900 text-gray-700 dark:text-white/80 rounded-t-none rounded-br-md rounded-bl-md',
menu: {
class: ['outline-none', 'm-0 p-0 list-none']
},
content: ({ context }) => ({
class: [
'text-gray-700 dark:text-white/80 transition-shadow duration-200 border-none rounded-none',
'hover:bg-gray-200 dark:hover:bg-gray-800/80 hover:text-gray-700 dark:hover:text-white/80', // Hover
{
'bg-gray-300 text-gray-700 dark:text-white/80 dark:bg-gray-800/90': context.focused
}
]
}),
action: {
class: ['text-gray-700 dark:text-white/80 py-3 px-5 select-none', 'flex items-center cursor-pointer no-underline relative overflow-hidden']
},
icon: 'mr-2',
submenu: 'p-0 pl-4 m-0 list-none',
transition: TRANSITIONS.toggleable
}
}
`
},
code2: {
2023-09-22 12:54:14 +00:00
composition: `
<template>
<div class="card flex justify-center">
<PanelMenu :model="items" class="w-full md:w-96" />
</div>
</template>
<script setup>
import { ref } from "vue";
const items = ref([
{
label: 'File',
icon: 'pi pi-fw pi-file',
items: [
{
label: 'New',
icon: 'pi pi-fw pi-plus',
items: [
{
label: 'Bookmark',
icon: 'pi pi-fw pi-bookmark'
},
{
label: 'Video',
icon: 'pi pi-fw pi-video'
}
]
},
{
label: 'Delete',
icon: 'pi pi-fw pi-trash'
},
{
label: 'Export',
icon: 'pi pi-fw pi-external-link'
}
]
},
{
label: 'Edit',
icon: 'pi pi-fw pi-pencil',
items: [
{
label: 'Left',
icon: 'pi pi-fw pi-align-left'
},
{
label: 'Right',
icon: 'pi pi-fw pi-align-right'
},
{
label: 'Center',
icon: 'pi pi-fw pi-align-center'
},
{
label: 'Justify',
icon: 'pi pi-fw pi-align-justify'
}
]
},
{
label: 'Users',
icon: 'pi pi-fw pi-user',
items: [
{
label: 'New',
icon: 'pi pi-fw pi-user-plus'
},
{
label: 'Delete',
icon: 'pi pi-fw pi-user-minus'
},
{
label: 'Search',
icon: 'pi pi-fw pi-users',
items: [
{
label: 'Filter',
icon: 'pi pi-fw pi-filter',
items: [
{
label: 'Print',
icon: 'pi pi-fw pi-print'
}
]
},
{
icon: 'pi pi-fw pi-bars',
label: 'List'
}
]
}
]
},
{
label: 'Events',
icon: 'pi pi-fw pi-calendar',
items: [
{
label: 'Edit',
icon: 'pi pi-fw pi-pencil',
items: [
{
label: 'Save',
icon: 'pi pi-fw pi-calendar-plus'
},
{
label: 'Delete',
icon: 'pi pi-fw pi-calendar-minus'
}
]
},
{
2023-10-30 10:43:15 +00:00
label: 'Archive',
icon: 'pi pi-fw pi-calendar-times',
items: [
{
label: 'Remove',
icon: 'pi pi-fw pi-calendar-minus'
}
]
}
]
}
]);
2023-10-15 09:38:39 +00:00
<\/script>
`
}
};
}
};
</script>