primevue-mirror/doc/steps/TemplateDoc.vue

137 lines
3.8 KiB
Vue
Raw Normal View History

2023-11-09 13:32:32 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Steps offers item customization with the <i>item</i> template that receives the item instance from the model as a parameter.</p>
</DocSectionText>
<div class="card">
<Steps :model="items" class="custom-steps" :readonly="false">
<template #item="{ item, active }">
<span :class="['inline-flex align-items-center justify-content-center align-items-center border-circle border-primary border-1 h-3rem w-3rem z-1 cursor-pointer', { 'bg-primary': active, 'surface-overlay text-primary': !active }]">
<i :class="[item.icon, 'text-xl']" />
</span>
</template>
</Steps>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
items: [
{
icon: 'pi pi-user'
},
{
icon: 'pi pi-calendar'
},
{
icon: 'pi pi-check'
}
],
code: {
basic: `
<Steps :model="items" class="custom-steps" :readonly="false">
<template #item="{ item, active }">
<span :class="['inline-flex align-items-center justify-content-center align-items-center border-circle border-primary border-1 h-3rem w-3rem z-1 cursor-pointer', { 'bg-primary': active, 'surface-overlay text-primary': !active }]">
<i :class="[item.icon, 'text-xl']" />
</span>
</template>
</Steps>
`,
options: `
<template>
<div class="card">
<Steps :model="items" class="custom-steps" :readonly="false">
<template #item="{ item, active }">
<span :class="['inline-flex align-items-center justify-content-center align-items-center border-circle border-primary border-1 h-3rem w-3rem z-1 cursor-pointer', { 'bg-primary': active, 'surface-overlay text-primary': !active }]">
<i :class="[item.icon, 'text-xl']" />
</span>
</template>
</Steps>
</div>
</template>
<script>
export default {
data() {
return {
items: [
{
icon: 'pi pi-user'
},
{
icon: 'pi pi-calendar'
},
{
icon: 'pi pi-check'
}
]
}
}
}
<\/script>
2024-03-27 08:30:38 +00:00
<style lang="scss" scoped>
::v-deep(.custom-steps) {
.p-steps-item:before {
margin-top: 0;
border-color: var(--p-primary-color);
}
}
<\/style>
2023-11-09 13:32:32 +00:00
`,
composition: `
<template>
<div class="card">
<Steps :model="items" class="custom-steps" :readonly="false">
<template #item="{ item, active }">
<span :class="['inline-flex align-items-center justify-content-center align-items-center border-circle border-primary border-1 h-3rem w-3rem z-1 cursor-pointer', { 'bg-primary': active, 'surface-overlay text-primary': !active }]">
<i :class="[item.icon, 'text-xl']" />
</span>
</template>
</Steps>
</div>
</template>
<script setup>
import { ref } from "vue";
const items = ref([
{
icon: 'pi pi-user'
},
{
icon: 'pi pi-calendar'
},
{
icon: 'pi pi-check'
}
]);
<\/script>
2024-03-27 08:30:38 +00:00
<style lang="scss" scoped>
::v-deep(.custom-steps) {
.p-steps-item:before {
margin-top: 0;
border-color: var(--p-primary-color);
}
}
<\/style>
2023-11-09 13:32:32 +00:00
`
}
};
}
};
</script>
<style lang="scss" scoped>
::v-deep(.custom-steps) {
.p-steps-item:before {
margin-top: 0;
2024-03-27 08:30:38 +00:00
border-color: var(--p-primary-color);
2023-11-09 13:32:32 +00:00
}
}
</style>