You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the TerminusDB documents User Interface (UI) utility `terminusdb-documents-ui` to automatically generate customizable user interfaces for the document definitions in your TerminusDB schema. The utility takes frames as input and outputs forms in HTML format. A frame is the JSON structure of a JSON document, including the document's inherited properties and IRIs.
7
+
Use the TerminusDB documents User Interface (UI) utility `terminusdb-documents-ui` to automatically generate user interfaces for the document definitions in your TerminusDB schema. The utility takes frames as input and outputs forms in HTML format. A frame is the JSON structure of a JSON document, including the document's inherited properties and IRIs.
8
8
9
-
### Install and import
9
+
####Install and import
10
10
11
11
Install the utility from `npm`:
12
12
@@ -20,48 +20,68 @@ Import the `FrameViewer` component into your code:
20
20
import {FrameViewer} from '@terminusdb/terminusdb-documents-ui'
21
21
```
22
22
23
-
### The FrameViewer object
23
+
Import the `FrameViewer` css into your code:
24
24
25
-
Use the `FrameViewer` object of `terminusdb-documents-ui` to configure, customize, and display your forms. `FrameViewer` supports several parameters and functions.
Use the `FrameViewer` object of `terminusdb-documents-ui` to configure and display your forms. `FrameViewer` supports several parameters and functions.
[Step 2. Configure properties and functions](./#step-2.-configure-properties-and-functions)
102
+
[Step 2. Configure properties and functions](..#step-2.-configure-properties-and-functions)
83
103
84
-
[Step 3. Generate the form](./#step-3.-generate-the-form)
104
+
[Step 3. Generate the form](..#step-3.-generate-the-form)
85
105
86
-
#### Step 1. Create frame data
106
+
**Step 1. Create frame data**
87
107
88
108
For simplicity, all examples use the `frames` definition below consisting of one document `Person`.
89
109
@@ -111,19 +131,11 @@ let frames = {
111
131
let type ="Person"
112
132
```
113
133
114
-
#### Step 2. Configure properties and functions
134
+
**Step 2. Configure properties and functions**
115
135
116
-
The example below generates an empty frame for the attributes of the `Person` document. The callback function `handleSubmit` displays any user-entered form data. Add functionality to `handleSubmit` to suit your requirements. The `uiFrames` parameter in the example adds customizations for your forms. See Customize the looks and feel of frames for details.
136
+
The example below generates an empty frame for the attributes of the `Person` document. The callback function `handleSubmit` displays any user-entered form data. Add functionality to `handleSubmit` to suit your requirements.
117
137
118
138
```javascript
119
-
// Create a place holder for the "Person" "name" property.
120
-
121
-
let uiFrames = {
122
-
"name": {
123
-
"placeholder":"Please enter a name ..."
124
-
}
125
-
}
126
-
127
139
// Mode "Create" displays an empty frame.
128
140
129
141
let mode ="Create"
@@ -135,7 +147,7 @@ function handleSubmit(data) {
135
147
}
136
148
```
137
149
138
-
#### Step 3. Generate the form
150
+
**Step 3. Generate the form**
139
151
140
152
Generate the form using the properties and functions defined in the previous step.
141
153
@@ -144,30 +156,24 @@ Generate the form using the properties and functions defined in the previous ste
The `View` mode displays populated frames for view-only - the **Submit** button is automatically hidden. If the `formData` parameter is omitted, an empty form is displayed.
215
216
@@ -241,24 +242,7 @@ function handleSubmit(data) {
0 commit comments