Skip to content

Commit 043e3da

Browse files
committed
feat(docs): add docs page for textarea
1 parent 2d60b29 commit 043e3da

File tree

2 files changed

+214
-1
lines changed

2 files changed

+214
-1
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<div class="textarea-demo">
3+
<CodeBlock v-if="type === 'default'">
4+
<template #preview>
5+
<PUTextArea
6+
v-model="demoValue"
7+
placeholder="Enter text..."
8+
/>
9+
</template>
10+
<template #code>
11+
<slot name="code" />
12+
</template>
13+
</CodeBlock>
14+
15+
<CodeBlock v-if="type === 'disabled'">
16+
<template #preview>
17+
<PUTextArea
18+
v-model="disabledValue"
19+
placeholder="Disabled textarea"
20+
disabled
21+
/>
22+
</template>
23+
<template #code>
24+
<slot name="code" />
25+
</template>
26+
</CodeBlock>
27+
28+
<CodeBlock v-if="type === 'with-label'">
29+
<template #preview>
30+
<div class="flex flex-col gap-1">
31+
<PULabel id="demoLabel">
32+
Description
33+
</PULabel>
34+
<PUTextArea
35+
id="demoLabel"
36+
v-model="labelValue"
37+
placeholder="Enter description..."
38+
/>
39+
</div>
40+
</template>
41+
<template #code>
42+
<slot name="code" />
43+
</template>
44+
</CodeBlock>
45+
</div>
46+
</template>
47+
48+
<script lang="ts" setup>
49+
import { ref } from 'vue'
50+
51+
defineProps<{
52+
type: 'default' | 'disabled' | 'with-label'
53+
}>()
54+
55+
const demoValue = ref('')
56+
const disabledValue = ref('')
57+
const labelValue = ref('')
58+
</script>
Lines changed: 156 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,156 @@
1-
pu-textarea
1+
::doc-topic
2+
#title
3+
PU-TextArea Component
4+
#description
5+
A customizable textarea component with enhanced interaction features
6+
::
7+
8+
::doc-topic
9+
#title
10+
Usage
11+
#description
12+
Basic Usage
13+
::
14+
::paper-show-textarea{type="default"}
15+
#code
16+
```html
17+
<template>
18+
<PUTextArea
19+
placeholder="Enter your text..."
20+
v-model="textValue"
21+
/>
22+
</template>
23+
```
24+
::
25+
26+
::doc-topic
27+
#description
28+
### Disabled State
29+
::
30+
::paper-show-textarea{type="disabled"}
31+
#code
32+
```html
33+
<template>
34+
<PUTextArea
35+
placeholder="Disabled textarea"
36+
disabled
37+
v-model="disabledValue"
38+
/>
39+
</template>
40+
```
41+
::
42+
43+
::doc-topic
44+
#description
45+
### With Label
46+
::
47+
::paper-show-textarea{type="with-label"}
48+
#code
49+
```html
50+
<template>
51+
<div class="flex flex-col gap-1">
52+
<PULabel id="description">Description</PULabel>
53+
<PUTextArea
54+
id="description"
55+
v-model="description"
56+
placeholder="Enter description..."
57+
/>
58+
</div>
59+
</template>
60+
```
61+
::
62+
63+
::doc-topic
64+
#title
65+
## Props
66+
::
67+
::doc-table
68+
---
69+
headers: ['Prop', 'Type', 'Required', 'Default', 'Description']
70+
rows:
71+
- - 'modelValue'
72+
- 'string | number | null'
73+
- 'Yes'
74+
- '-'
75+
- 'Textarea value (v-model support)'
76+
- - 'disabled'
77+
- 'boolean'
78+
- 'No'
79+
- 'false'
80+
- 'Disables the textarea'
81+
- - 'placeholder'
82+
- 'string'
83+
- 'No'
84+
- "''"
85+
- 'Placeholder text'
86+
- - 'id'
87+
- 'string'
88+
- 'No'
89+
- 'undefined'
90+
- 'Unique identifier for the textarea'
91+
---
92+
::
93+
94+
::doc-topic
95+
#title
96+
## Events
97+
::
98+
::doc-table
99+
---
100+
headers: ['Event', 'Description', 'Payload']
101+
rows:
102+
- - 'update:modelValue'
103+
- 'Emits on input change, blur or Enter key'
104+
- 'string | number | null'
105+
- - 'blur'
106+
- 'Triggers on field blur'
107+
- 'Event'
108+
- - 'keydown.enter'
109+
- 'Triggers on Enter key press'
110+
- 'KeyboardEvent'
111+
---
112+
::
113+
114+
::doc-topic
115+
#title
116+
## Styling
117+
#description
118+
- Base styling with Tailwind:
119+
::code-box{header="Core Structure" type="css" copy}
120+
```css
121+
.pu-textarea--default {
122+
@apply w-full p-2;
123+
@apply border-2 border-primary-light-500 rounded-lg;
124+
@apply text-gray-800 text-base;
125+
@apply focus:outline-none;
126+
}
127+
```
128+
::
129+
- Interactive states:
130+
::code-box{header="Focus State" type="css" copy}
131+
```css
132+
.focus\:outline-none:focus {
133+
@apply ring-2 ring-primary-light-500;
134+
}
135+
```
136+
::
137+
138+
::doc-topic
139+
#title
140+
## Features
141+
#description
142+
- v-model support
143+
- Enter key handling
144+
- Blur event integration
145+
- Accessible disabled state
146+
- Customizable placeholder
147+
::
148+
149+
::doc-topic
150+
#title
151+
## Dependencies
152+
#description
153+
- Tailwind CSS for styling
154+
- Vue 3 Composition API
155+
- Optional PULabel component for labeled inputs
156+
::

0 commit comments

Comments
 (0)