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

76 lines
2.5 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
<NuxtLink to="/tailwind">Tailwind Customization</NuxtLink> section for an example.
</p>
<DocSectionCode :code="code1" hideToggleCode importCode hideCodeSandbox hideStackBlitz />
<p>A playground sample with the pre-built Tailwind theme.</p>
<DocSectionCode :code="code2" embedded />
</DocSectionText>
</template>
<script>
export default {
data() {
return {
code1: {
basic: `
export default {
fileupload: {
input: 'hidden',
buttonbar: {
class: ['flex flex-wrap', 'bg-gray-50 dark:bg-gray-800 p-5 border border-solid border-gray-300 dark:border-blue-900/40 text-gray-700 dark:text-white/80 rounded-tr-lg rounded-tl-lg gap-2 border-b-0']
},
chooseButton: {
class: ['text-white bg-blue-500 border border-blue-500 p-3 px-5 rounded-md text-base', 'overflow-hidden relative']
},
chooseIcon: 'mr-2 inline-block',
chooseButtonLabel: 'flex-1 font-bold',
uploadbutton: {
icon: 'mr-2'
},
cancelbutton: {
icon: 'mr-2'
},
content: {
class: ['relative', 'bg-white dark:bg-gray-900 p-8 border border-gray-300 dark:border-blue-900/40 text-gray-700 dark:text-white/80 rounded-b-lg']
},
file: {
class: ['flex items-center flex-wrap', 'p-4 border border-gray-300 dark:border-blue-900/40 rounded gap-2 mb-2', 'last:mb-0']
},
thumbnail: 'shrink-0',
fileName: 'mb-2',
fileSize: 'mr-2',
uploadicon: 'mr-2'
}
}
`
},
code2: {
composition: `
<template>
<div class="card">
<Toast />
<FileUpload name="demo[]" url="./upload.php" @upload="onAdvancedUpload($event)" :multiple="true" accept="image/*" :maxFileSize="1000000">
<template #empty>
<p>Drag and drop files to here to upload.</p>
</template>
</FileUpload>
</div>
</template>
<script setup>
import { useToast } from "primevue/usetoast";
const toast = useToast();
const onAdvancedUpload = () => {
toast.add({ severity: 'info', summary: 'Success', detail: 'File Uploaded', life: 3000 });
};
<\/script>`
}
};
}
};
</script>