Skip to content

Commit ee3c506

Browse files
committed
Documentation for x-schema-form
1 parent 1860103 commit ee3c506

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Documentation
44
1. [Basic Usage](#basic-usage)
55
1. [Handling Submit](#handling-submit)
66
1. [Global Options](#global-options)
7+
1. [Form defaults in schema](#form-defaults-in-schema)
78
1. [Form types](#form-types)
89
1. [Default form types](#default-form-types)
910
1. [Form definitions](#form-definitions)
@@ -174,7 +175,29 @@ Ex.
174175
</div>
175176
```
176177
178+
Form defaults in schema
179+
-----------------------
180+
Its recommended to split presentation and validation into a form definition and a json schema. But
181+
if you for some reason can't do this, but *do* have the power to change the schema, you can supply form
182+
default values within the schema using the custom attribute `x-schema-form`. `x-schema-form` should
183+
be a form object and acts as form definition defaults for that field.
177184
185+
Example schema.
186+
```js
187+
{
188+
"type": "object",
189+
"properties": {
190+
"comment": {
191+
"type": "string",
192+
"title": "Comment",
193+
"x-schema-form": {
194+
"type": "textarea",
195+
"placeholder": "Don't hold back"
196+
}
197+
}
198+
}
199+
}
200+
```
178201
179202
Form types
180203
----------

0 commit comments

Comments
 (0)