Skip to content

Commit 56ab7e5

Browse files
committed
docs(styling): Add Samples
1 parent 4da7b5b commit 56ab7e5

File tree

5 files changed

+102
-6
lines changed

5 files changed

+102
-6
lines changed

src/components/app/AppTopbar.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,17 @@ const items = ref([
5353
],
5454
},
5555
],
56+
57+
[
58+
{
59+
label: 'Styling',
60+
items: [
61+
{ label: 'Basic', icon: 'pi pi-fw pi-user-edit', to: '/demo/styling' },
62+
{ label: 'Pass Through', icon: 'pi pi-fw pi-user-edit', to: '/demo/passThrough' },
63+
],
64+
},
5665
],
66+
]
5767
},
5868
])
5969
</script>

src/components/demo/PrimeInput.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const documentationLink = `https://primevue.org/${props.header.replace('Prime',
2020
<template>
2121
<div>
2222
<h1>{{ header }}</h1>
23-
23+
<slot/>
2424
<div class="flex flex-wrap gap-12">
2525
<div class="min-w-30rem basis-1/3 md:basis-1/4">
2626
<FormKit

src/pages/demo/InputText.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
const primeAttributes = 'placeholder'
33
const customAttributes = 'iconLeft, iconRight'
44
5-
const pt_content = {
6-
root: { style: 'font-weight: 600;' },
7-
}
8-
95
const schema
106
= [
117
{
@@ -14,7 +10,6 @@ const schema
1410
label: 'Basic',
1511
help: 'Required.',
1612
validation: 'required',
17-
pt: pt_content,
1813
_readonly: true,
1914
},
2015
{

src/pages/demo/PassThrough.vue

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<script setup lang='ts'>
2+
const primeAttributes = 'placeholder'
3+
const customAttributes = 'iconLeft, iconRight'
4+
5+
const pt_content = {
6+
root: { style: 'font-weight: 600;color: green;' },
7+
}
8+
9+
const schema
10+
= [
11+
{
12+
$formkit: 'primeInputText',
13+
name: 'name',
14+
label: 'Basic',
15+
help: 'Required.',
16+
validation: 'required',
17+
pt: pt_content
18+
},
19+
20+
]
21+
22+
const data = { name: 'Some Text in Green' }
23+
</script>
24+
25+
<template>
26+
<div class="">
27+
<PrimeInput
28+
header="Pass Through" :schema="schema" :data="data"
29+
:prime-attributes="primeAttributes" :custom-attributes="customAttributes"
30+
/>
31+
</div>
32+
</template>
33+
34+
<style lang='scss' scoped>
35+
36+
</style>

src/pages/demo/Styling.vue

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<script setup lang='ts'>
2+
const primeAttributes = 'placeholder'
3+
const customAttributes = 'iconLeft, iconRight'
4+
5+
const schema
6+
= [
7+
{
8+
$formkit: 'primeInputText',
9+
name: 'name',
10+
label: 'Styling by class',
11+
help: 'Required.',
12+
validation: 'required',
13+
class: 'stylingSampleClass',
14+
},
15+
{
16+
$formkit: 'primeInputText',
17+
name: 'name2',
18+
label: 'Styling by class',
19+
help: 'Required.',
20+
validation: 'required',
21+
style: 'color: gray;font-weight: 700;',
22+
},
23+
24+
]
25+
26+
const data = { name: 'Some Text in Green', name2: 'Some bold Text in Gray' }
27+
</script>
28+
29+
<template>
30+
<div class="">
31+
<PrimeInput
32+
header="Styling" :schema="schema" :data="data"
33+
:prime-attributes="primeAttributes" :custom-attributes="customAttributes"
34+
>
35+
<div class="pb-8">
36+
<span>Use Custom classes for better styling. <br/>To be specific you can use use the parent div class: p-formkit.
37+
<br/>
38+
Direct styling by the style attribute.
39+
<br/>
40+
In this demo elements with the p-formkit class use only 60% of the parent width.
41+
</span>
42+
</div>
43+
</PrimeInput>
44+
</div>
45+
</template>
46+
47+
<style lang='scss'>
48+
49+
.p-formkit {
50+
width:60%;
51+
.stylingSampleClass {
52+
color: green;
53+
}
54+
}
55+
</style>

0 commit comments

Comments
 (0)