api-viewer-element icon indicating copy to clipboard operation
api-viewer-element copied to clipboard

Make it possible to pass complex properties (objects, arrays) to element

Open blikblum opened this issue 4 years ago • 1 comments
trafficstars

Hi, just tried api-viewer but could not get how to pass an array to an element

The element, written in lit expects a property to be passed as array. It does not reflect to attribute.

I tried using lit-html as below without success:

import 'api-viewer-element'
import '../browserAction/patient-list.js'
import { html, render } from '../third-party/lit.js'

const patients = [{ name: 'João' }, { name: 'Maria' }]

const apiTemplate = html`
  <api-viewer src="../custom-elements.json">
    <template data-element="patient-list" data-target="host">
      <patient-list .patients=${patients}></patient-list>
    </template>
  </api-viewer>
`
render(apiTemplate, document.body)

blikblum avatar Nov 08 '21 09:11 blikblum

Thanks for the issue. This is not supported at the moment. I need to think about how to handle this, without being tied to Lit templates.

web-padawan avatar Nov 08 '21 10:11 web-padawan