Skip to content

Commit 5f1277d

Browse files
authored
Merge pull request #262 from Screenly/ea-json-fields-docs
Adds documentation for help_text - input field types
2 parents efbe228 + 86b4bf3 commit 5f1277d

1 file changed

Lines changed: 134 additions & 0 deletions

File tree

docs/EdgeApps.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,140 @@ settings:
416416
help_text: An example of an API key
417417
```
418418

419+
#### Input field types
420+
421+
Edge App settings support additional input field types beyond plain text and password. To render a specific input type in the UI, embed a small JSON descriptor inside the setting's `help_text` field. This JSON does not change the underlying storage type (which remains `string` or `secret`); it only instructs the UI how to render the input.
422+
423+
- **Schema**: The JSON must include `schema_version` and a `properties` object.
424+
- **Common keys**:
425+
- `properties.type`: One of `datetime`, `number`, `select`, `boolean`, `textarea`, `url`.
426+
- `properties.help_text`: Human-friendly description shown in the UI.
427+
- `properties.options` (only for `select`): Array of `{ label, value }` options.
428+
- **Storage**: Use `type: string` for all non-secret fields; use `type: secret` for password-like fields. The UI will coerce values appropriately (e.g., booleans) but values are stored as strings unless `type: secret`.
429+
- **Defaults**: Provide `default_value` at the setting level. For booleans, use `'true'` or `'false'` as strings.
430+
431+
Examples:
432+
433+
**Datetime picker**
434+
435+
```yaml
436+
settings:
437+
date_time_field:
438+
type: string
439+
title: Start Date Time
440+
optional: false
441+
help_text: |
442+
{
443+
"schema_version": 1,
444+
"properties": {
445+
"help_text": "The start date and time of the event",
446+
"type": "datetime"
447+
}
448+
}
449+
```
450+
451+
**Number input**
452+
453+
```yaml
454+
settings:
455+
number_field:
456+
type: string
457+
title: Attendee Count
458+
optional: false
459+
help_text: |
460+
{
461+
"schema_version": 1,
462+
"properties": {
463+
"help_text": "The expected count of attendees",
464+
"type": "number"
465+
}
466+
}
467+
```
468+
469+
**Select (dropdown) input**
470+
471+
```yaml
472+
settings:
473+
select_field:
474+
type: string
475+
title: Select Role
476+
default_value: editor
477+
optional: false
478+
help_text: |
479+
{
480+
"schema_version": 1,
481+
"properties": {
482+
"type": "select",
483+
"help_text": "The role of the user",
484+
"options": [
485+
{ "label": "Admin", "value": "admin" },
486+
{ "label": "Editor", "value": "editor" },
487+
{ "label": "Viewer", "value": "viewer" }
488+
]
489+
}
490+
}
491+
```
492+
493+
**Boolean (switch) input**
494+
495+
```yaml
496+
settings:
497+
switch_field:
498+
type: string
499+
title: Subscribe
500+
default_value: "true" # or 'false'
501+
optional: false
502+
help_text: |
503+
{
504+
"schema_version": 1,
505+
"properties": {
506+
"help_text": "Subscribe to updates",
507+
"type": "boolean"
508+
}
509+
}
510+
```
511+
512+
**Text area input**
513+
514+
```yaml
515+
settings:
516+
text_area_field:
517+
type: string
518+
title: Description
519+
default_value: Field description
520+
optional: false
521+
help_text: |
522+
{
523+
"schema_version": 1,
524+
"properties": {
525+
"help_text": "The description of the event",
526+
"type": "textarea"
527+
}
528+
}
529+
```
530+
531+
**URL input**
532+
533+
```yaml
534+
settings:
535+
url_field:
536+
type: string
537+
title: Website URL
538+
optional: false
539+
help_text: |
540+
{
541+
"schema_version": 1,
542+
"properties": {
543+
"help_text": "The URL of the website",
544+
"type": "url"
545+
}
546+
}
547+
```
548+
549+
Notes:
550+
551+
- These descriptors are backward-compatible; if no JSON is provided, the UI falls back to a plain text field for `string` and a password field for `secret`.
552+
419553
#### Reserved setting names
420554

421555
Settings starting with `screenly_` are reserved and cannot be used in the manifest file.

0 commit comments

Comments
 (0)