@hmiproject/helio-sdk
    Preparing search index...

    Function List

    Declares a prop that holds an ordered list of values of a single item type.

    Items can be declared with any props.* helper except props.Children, including props.Object for lists of structured values. In the IDE the list is rendered as its own top-level group where items can be added, removed and reordered; an optional list also gets a checkbox to enable or disable it.

    New items are initialized with the defaultValue of the item definition.

    Declaring a list property

    {
    points: props.List({
    label: 'Points',
    optional: false,
    item: props.Object({
    label: 'Point',
    optional: false,
    shape: {
    x: props.Number({
    label: 'X',
    optional: false,
    defaultValue: 0
    }),
    y: props.Number({
    label: 'Y',
    optional: false,
    defaultValue: 0
    }),
    },
    }),
    }),
    }
    • Optional List Property

      Type Parameters

      • Item extends ListItemDef

      Parameters

      • options: Omit<ConditionalTypeOptions, "enabledIf"> & {
            description?: string;
            item: Item;
            label: string;
        } & { defaultValue?: Item["type"][]; optional: true }
        • Optionaldescription?: string

          An optional description that will be displayed below the property in the editor to help users understand the purpose of this property.

        • item: Item

          The prop definition of the items in this list. Declare it using the same props.* helpers as in a schema, with any type except props.Children. Item definitions must use optional: false so that newly added items always carry an editable value.

          The item's label is used to identify items in the editor (e.g. as "Point #1") when the item value cannot represent itself.

          props.Object({
          label: 'Point',
          optional: false,
          shape: {
          x: props.Number({
          label: 'X', optional: false, defaultValue: 0
          }),
          y: props.Number({
          label: 'Y', optional: false, defaultValue: 0
          }),
          },
          })
        • label: string

          Human-readable label for this property. Will be used to represent this property in the UI.

        • OptionaldefaultValue?: Item["type"][]

          The default value for this property. When omitted, the property defaults to undefined and the list is disabled in the editor until it is enabled explicitly.

        • optional: true

          Mark this as an optional value that can also take the value undefined.

      Returns ListDef<Item> & {
          defaultValue: Item["type"][] | undefined;
          optional: true;
          type: Item["type"][] | undefined;
      }

    • Non-Optional List Property

      Type Parameters

      • Item extends ListItemDef

      Parameters

      • options: Omit<ConditionalTypeOptions, "enabledIf"> & {
            description?: string;
            item: Item;
            label: string;
        } & { defaultValue?: Item["type"][]; optional: false }
        • Optionaldescription?: string

          An optional description that will be displayed below the property in the editor to help users understand the purpose of this property.

        • item: Item

          The prop definition of the items in this list. Declare it using the same props.* helpers as in a schema, with any type except props.Children. Item definitions must use optional: false so that newly added items always carry an editable value.

          The item's label is used to identify items in the editor (e.g. as "Point #1") when the item value cannot represent itself.

          props.Object({
          label: 'Point',
          optional: false,
          shape: {
          x: props.Number({
          label: 'X', optional: false, defaultValue: 0
          }),
          y: props.Number({
          label: 'Y', optional: false, defaultValue: 0
          }),
          },
          })
        • label: string

          Human-readable label for this property. Will be used to represent this property in the UI.

        • OptionaldefaultValue?: Item["type"][]

          The default value for this property. When omitted, the list defaults to an empty array.

        • optional: false

          Mark this as an optional value that can also take the value undefined.

      Returns ListDef<Item> & {
          defaultValue: Item["type"][];
          enabledIf: undefined;
          optional: false;
          type: Item["type"][];
      }