Prop for state selection

I am writing a widget, and in the configuration I’d like to have a field to select an item and then a second field where a state of the item shall be selected. Is it possible to configure the second field to offer a list of the available states of the Item (e.g. ON/OFF)?

My YAML looks like, this, the second field is where I’d like to see the list of possible states. Maybe the context parameter is relevant here, but I could not find a documentation of what values are allowed there, and the only examples I could find use context=item.

    - context: item
      description: Item to use with this button.
      label: Item
      name: item
      required: true
      type: TEXT
      groupName: item
    - description: Command to send to the item.
      label: Command
      name: command
      required: true
      type: TEXT
      groupName: item

I can’t say if this is comprehensive not can I say all of these will work for widgets, but [Do not install] Rule Template Parameters Experiments and Examples has examples of a bunch of them.

I cobbled together these examples based on Configuration Descriptions | openHAB

Thanks - from those examples and the documentation it seems what I am trying to achieve is not possible.

Yes, you can specify a list of options for a widget property. It looks like this:

    - default: F
      description: Temperature units
      label: Units
      name: units
      required: true
      type: TEXT
      groupName: general
      limitToOptions: true
      options:
        - label: °C
          value: C
        - label: °F
          value: F

image

Thanks, but what I was looking for was to automatically get the state options available for a selected item, like you have it when working with items and rules.