summaryrefslogtreecommitdiff
path: root/form_input.go
diff options
context:
space:
mode:
Diffstat (limited to 'form_input.go')
-rw-r--r--form_input.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/form_input.go b/form_input.go
new file mode 100644
index 0000000..fd0bd66
--- /dev/null
+++ b/form_input.go
@@ -0,0 +1,28 @@
+package trunks
+
+type FormInputKind string
+
+const (
+ FormInputKindNumber = "number"
+ FormInputKindString = "string"
+)
+
+//
+// FormInput provide the information to create an input component.
+//
+// The Label field define the input text, the Hint field provide a
+// description about the input, the Kind field describe the type of input
+// (number, string, and so on), and the Value field contains default value for
+// input.
+//
+// The Max and Min fields is optional, can be set if the Kind is
+// FormInputKindNumber.
+//
+type FormInput struct {
+ Label string `json:"label"`
+ Hint string `json:"hint"`
+ Kind FormInputKind `json:"kind"`
+ Value string `json:"value"`
+ Max float64 `json:"max,omitempty"`
+ Min float64 `json:"min,omitempty"`
+}