Text area field
The text area field stores strings with line breaks.
Examples
Here's an example of using the text area field in a block:
# blocks/Code.vue
<template>
<pre>
<code>{{ code }}</code>
</pre>
</template>
<script lang="ts" setup>
import { textAreaField } from '#pruvious'
defineProps({
code: textAreaField({
placeholder: 'Enter code here',
}),
})
</script>
Here is another example of how to use it in a collection definition:
# collections/settings.ts
import { defineCollection } from '#pruvious'
export default defineCollection({
name: 'settings',
mode: 'single',
fields: {
trackingScript: {
type: 'text-area',
options: {},
},
},
})
Options
You can specify the following options in the text area field:
Option | Description |
---|---|
| The default field value (an empty string if not defined). |
| A brief descriptive text displayed in code comments and in a tooltip at the upper right corner of the field. |
| The field label displayed in the UI. By default, it is automatically generated based on the property name assigned to the field. For example, description becomes Description. |
| A string that specifies the |
| Text that appears in the input element when it has no value set. |
| Specifies that the input field is mandatory during creation and cannot have an empty string value. |
| A booleanish value indicating whether spellchecking is enabled for the input element. Defaults to |
| Specifies whether to remove whitespace from both ends of the input string. |
| Specifies whether the text in the field should be automatically wrapped. If |
Last updated on January 9, 2024 at 11:20