Skip to content

Schema & Component Requirements

Max Heiber edited this page Jul 7, 2017 · 8 revisions

Spaces are dependent on two components and two properties in your schemas.

Component Dependencies

Spaces require:

Schema Requirements

Requirements for Space and Logic components are as follows:

Logic

The only requirement for a Logic is that its schema contains a property called embeddedComponent which is set to an empty object. Here is an example Logic component which displays its embedded component based on time:

_description: |
  A description of this Logic

startTime:
  _label: Start Time
  _display: settings
  _has:
    -
      fn: text
      type: datetime-local
    - label
    -
      fn: description
      value: The start time that the component should be displayed on

endTime:
  _label: End Time
  _display: settings
  _has:
    -
      fn: text
      type: datetime-local
    - label
    -
      fn: description
      value: The end time that the component should stop being displayed on

_groups:
  settings:
    fields:
      - startTime
      - endTime

Optional Component Schema _targeting for Readouts

When adding a component to a space, the panel for selecting/editing a component shows "readouts", which are labels and icons that help to distinguish between component instances that are of the same component type.

screen shot 2017-05-31 at 4 48 02 pm

schema.yml:

_targeting:
    -
    property: tag
    icon: tag
    -
    property: title
    icon: clock

The component that will be inside of the logic component

embeddedComponent: {}


Space

A Space component requires two things:

  1. A name that begins with clay-space. Name the component clay-space-<SOMETHING DESCRIPTIVE>
  2. A property called content which has the _componentList behavior. Instantiates as an empty array.
  3. Only has one component in the Component List. This component is assumed to be the corresponding Logic component for the Space and will wrap each component.

An example of a Space schema might look like:

_description: |
  My Space!

content:
  _componentList:
    min: 1
    include:
      - my-logic-component
Clone this wiki locally