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

66 lines
2.7 KiB
Vue
Raw Normal View History

2023-08-07 09:03:52 +00:00
<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.
2023-08-07 09:03:52 +00:00
</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 09:03:52 +00:00
<DocSectionCode :code="code2" embedded />
</DocSectionText>
</template>
<script>
export default {
data() {
return {
code1: {
2023-10-15 09:38:39 +00:00
basic: `
export default {
2023-08-07 09:03:52 +00:00
directives: {
tooltip: {
root: ({ context }) => ({
class: [
'absolute shadow-md',
{
'py-0 px-1': context?.right || context?.left || (!context?.right && !context?.left && !context?.top && !context?.bottom),
'py-1 px-0': context?.top || context?.bottom
}
]
}),
arrow: ({ context }) => ({
class: [
'absolute w-0 h-0 border-transparent border-solid',
{
'-m-t-1 border-y-[0.25rem] border-r-[0.25rem] border-l-0 border-r-gray-600': context?.right || (!context?.right && !context?.left && !context?.top && !context?.bottom),
'-m-t-1 border-y-[0.25rem] border-l-[0.25rem] border-r-0 border-l-gray-600': context?.left,
'-m-l-1 border-x-[0.25rem] border-t-[0.25rem] border-b-0 border-t-gray-600': context?.top,
'-m-l-1 border-x-[0.25rem] border-b-[0.25rem] border-t-0 border-b-gray-600': context?.bottom
}
]
}),
text: {
class: 'p-3 bg-gray-600 text-white rounded-md whitespace-pre-line break-words'
}
}
}
}
`
},
code2: {
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-08-07 09:03:52 +00:00
<div class="card flex flex-wrap justify-center gap-2">
<InputText v-tooltip="'Enter your username'" type="text" placeholder="Right" />
<InputText v-tooltip.top="'Enter your username'" type="text" placeholder="Top" />
<InputText v-tooltip.bottom="'Enter your username'" type="text" placeholder="Bottom" />
<InputText v-tooltip.left="'Enter your username'" type="text" placeholder="Left" />
</div>
2023-11-01 14:36:59 +00:00
</template>
`
2023-08-07 09:03:52 +00:00
}
};
}
};
</script>