section

Learn how to use the section component in your user interface to group related items together.

The section component groups related items together under a single title. A section can be set up on a jig.default under the entity component or on a form component as its container. The component can contain field-row and entity-field components or children components on a form component.

A component.section can be set up with the following combinations:

  1. An entity containing sections with rows and entity-field for display purposes.

  2. An entity containing sections and entity-field for display purposes.

  3. A form component containing sections with rows and children for display/capturing purposes.

  4. A form component containing sections and children components for display/capturing purposes.

  5. Horizontal lists cannot be used with the section components as an empty white jig will be displayed.

Some properties are common to all components, see Common component properties for a list and their configuration options.

Examples and code snippets

The Entity with sections, rows, and entity fields (Display only)

Jig with sections
Jig with sections

Using sections, rows, and entity fields to create relevant display sections for the information to be functional yet elegant and neatly organized.

Examples: See the full example using static data in GitHub See the full example using dynamic data in GitHub.

Datasources: See the full datasource for static data in GitHub. See the full datasource for dynamic data in GitHub

children:
  - type: component.entity
    options:
      children:
        - type: component.section
          options:
            title: Repair Services
            children:
              - type: component.field-row
                options:
                  children:
                    - type: component.entity-field
                      options:
                        label: Service
                        value: [email protected][id=1].service
              - type: component.field-row
                options:
                  children:
                    - type: component.entity-field
                      options:
                        label: Description
                        value: [email protected][id=1].description
                        isMultiline: true
        - type: component.section
          options:
            title: Rates
            children:
              - type: component.field-row
                options:
                  children:
                    - type: component.entity-field
                      options:
                        label: Hourly Rate
                        value: [email protected][id=1].hourlyRate
                    - type: component.entity-field
                      options:
                        label: Time
                        value: [email protected][id=1].time & ' minutes'
                    - type: component.entity-field
                      options:
                        label: Materials
                        value: =(@ctx.datasources.repair-services-static[id=1].materials = 'True' ? true :false)
                        contentType: checkbox
Section-rows-entity-fields (dynamic)
children:
  - type: component.entity
    options:
      children:
        - type: component.section
          options:
            title: Cleaning Services
            children:
              - type: component.field-row
                options:
                  children:
                    - type: component.entity-field
                      options:
                        label: Service
                        value: [email protected][0].service
                    - type: component.entity-field
                      options:
                        label: Area
                        value: [email protected][0].area
              - type: component.field-row
                options:
                  children:
                    - type: component.entity-field
                      options:
                        label: Time
                        value: [email protected][0].time & ' minutes'
                    - type: component.entity-field
                      options:
                        label: Indoor
                        value: [email protected][0].indoor
                        contentType: checkbox
              - type: component.field-row
                options:
                  children:
                    - type: component.entity-field
                      options:
                        label: Description
                        value: [email protected][0].description
                        isMultiline: true
        - type: component.section
          options:
            title: Rates
            children:
              - type: component.field-row
                options:
                  children:
                    - type: component.entity-field
                      options:
                        label: Hourly Rate
                        value: [email protected][0].hourlyrate != null ? @ctx.datasources.cleaning-services-dynamic[0].hourlyrate:'N/A'
                    - type: component.entity-field
                      options:
                        label: Once Off Rate
                        value: [email protected][0].onceoffrate != null ? @ctx.datasources.cleaning-services-dynamic[0].onceoffrate:'N/A'

Form with sections, rows, and children components (Display and input)

Jig with sections & rows
Jig with sections & rows

Similar to the above example, this has the same functionality, except that this is for adding or editing data too, and not just for display purposes.

Examples: See the full example using dynamic data in GitHub.

Datasource: See the full datasource for dynamic data in GitHub.

Entity with sections and entity-fields (Display only)

Entity with sections and entity-fields
Entity with sections and entity-fields

This is another example for display purposes only, but this time without the rows. Note the difference in the fields as they now display below each other instead of numerous entity-fields in a row.

Examples: Basic- See the full example using static data in GitHub. Compact - See the full example using static data in GitHub.

Datasources: See the full datasource for static data in GitHub. See the full datasource for dynamic data in GitHub.

Form with sections and entity-fields (Display and input)

Form with sections
Form with sections

This is the same as the above, again with the exception of being used in a form component and not just being for display purposes, but allowing input from the user.

Examples: See the full example using dynamic data in GitHub.

Datasources: See the full datasource for dynamic data in GitHub.

Last updated

Was this helpful?