@mapeo/schema
Version:
JSON schema and flow types for Mapeo
180 lines (96 loc) • 3.5 kB
Markdown
[API](../README.md) / Field
# Interface: Field
A field defines a form field that will be shown to the user when creating or editing a map entity. Presets define which fields are shown to the user for a particular map entity. The field definition defines whether the field should show as a text box, multiple choice, single-select, etc. It defines what tag-value is set when the field is entered.
## Table of contents
### Properties
- [appearance](Field.md#appearance)
- [helperText](Field.md#helpertext)
- [id](Field.md#id)
- [key](Field.md#key)
- [label](Field.md#label)
- [max\_value](Field.md#max_value)
- [min\_value](Field.md#min_value)
- [options](Field.md#options)
- [placeholder](Field.md#placeholder)
- [readonly](Field.md#readonly)
- [snake\_case](Field.md#snake_case)
- [type](Field.md#type)
- [universal](Field.md#universal)
## Properties
### appearance
• `Optional` **appearance**: ``"singleline"`` \| ``"multiline"``
For text fields, display as a single-line or multi-line field
#### Defined in
field/v1.ts:35
___
### helperText
• `Optional` **helperText**: `string`
Additional context about the field, e.g. hints about how to answer the question.
#### Defined in
field/v1.ts:71
___
### id
• **id**: `string`
Unique value that identifies this element
#### Defined in
field/v1.ts:15
___
### key
• **key**: `string` \| `string`[]
They key in a tags object that this field applies to. For nested properties, key can be an array e.g. for tags = `{ foo: { bar: 1 } }` the key is `['foo', 'bar']`
#### Defined in
field/v1.ts:19
___
### label
• `Optional` **label**: `string`
Default language label for the form field label
#### Defined in
field/v1.ts:27
___
### max\_value
• `Optional` **max\_value**: `number`
Maximum field value (number, date or datetime fields only). For date or datetime fields, is seconds since unix epoch
#### Defined in
field/v1.ts:79
___
### min\_value
• `Optional` **min\_value**: `number`
Minimum field value (number, date or datetime fields only). For date or datetime fields, is seconds since unix epoch
#### Defined in
field/v1.ts:75
___
### options
• `Optional` **options**: (``null`` \| `string` \| `number` \| `boolean` \| { `[k: string]`: `unknown`; `label?`: `string` ; `value`: ``null`` \| `string` \| `number` \| `boolean` })[]
List of options the user can select for single- or multi-select fields
#### Defined in
field/v1.ts:43
___
### placeholder
• `Optional` **placeholder**: `string`
Displayed as a placeholder in an empty text or number field before the user begins typing. Use 'helperText' for important information, because the placeholder is not visible after the user has entered data.
#### Defined in
field/v1.ts:67
___
### readonly
• `Optional` **readonly**: `boolean`
Field is displayed, but it can't be edited
#### Defined in
field/v1.ts:31
___
### snake\_case
• `Optional` **snake\_case**: `boolean`
Convert field value into snake_case (replace spaces with underscores and convert to lowercase)
#### Defined in
field/v1.ts:39
___
### type
• **type**: ``"number"`` \| ``"text"`` \| ``"localized"`` \| ``"select_one"`` \| ``"select_multiple"`` \| ``"date"`` \| ``"datetime"``
Type of field - defines how the field is displayed to the user.
#### Defined in
field/v1.ts:23
___
### universal
• `Optional` **universal**: `boolean`
If true, this field will appear in the Add Field list for all presets
#### Defined in
field/v1.ts:63