summaryrefslogtreecommitdiff
path: root/design-documents/054-dynamic-form.rst
diff options
context:
space:
mode:
Diffstat (limited to 'design-documents/054-dynamic-form.rst')
-rw-r--r--design-documents/054-dynamic-form.rst14
1 files changed, 7 insertions, 7 deletions
diff --git a/design-documents/054-dynamic-form.rst b/design-documents/054-dynamic-form.rst
index 6ff84d41..d93b3684 100644
--- a/design-documents/054-dynamic-form.rst
+++ b/design-documents/054-dynamic-form.rst
@@ -51,7 +51,7 @@ readOnly (flag to disable input), onUpdate (callback on form data update),
and computeFormState (function to derive the form state based on current data).
-.. code-block:: javascript
+.. code-block:: typescript
interface FormType<T extends object> {
value: Partial<T>;
@@ -82,7 +82,7 @@ The field type ``AmountJson`` and ``AbsoluteTime`` are opaque since field is use
The form can be instanciated using
-.. code-block:: javascript
+.. code-block:: typescript
import { FormProvider } from "@gnu-taler/web-util/browser";
@@ -90,7 +90,7 @@ The form can be instanciated using
Then the field component can access all the properties by the ``useField(name)`` hook,
which will return
-.. code-block:: javascript
+.. code-block:: typescript
interface InputFieldHandler<Type> {
value: Type;
@@ -116,10 +116,10 @@ A set of common form field exist in ``@gnu-taler/web-util``:
and should be used inside a ``Form`` context.
-.. code-block:: javascript
+.. code-block:: none
function MyFormComponent():VNode {
- return <FormProvider >
+ return <FormProvider>
<InputAmount name="amount" />
<InputText name="subject" />
<button type="submit"> Confirm </button>
@@ -132,7 +132,7 @@ Example
Consider a form shape represented by the TypeScript type:
-.. code-block:: javascript
+.. code-block:: typescript
type TheFormType = {
name: string,
@@ -148,7 +148,7 @@ Consider a form shape represented by the TypeScript type:
An example instance of this form could be:
-.. code-block:: javascript
+.. code-block:: typescript
const theFormValue: TheFormType = {
name: "Sebastian",