lit icon indicating copy to clipboard operation
lit copied to clipboard

[@labs/react] support multiple children with multiple slots

Open taylor-vann opened this issue 3 years ago • 4 comments

Related to https://github.com/lit/lit/issues/2734

This PR supports multiple children by assigning them to multiple slots by wrapping them in a <div styles="display: contents">.

A client can provide a children map similar to how we account for events. The syntax is as follows:

const BasicElementComponent = createComponent(
  window.React,
  elementName,
  BasicElement,
  basicElementEvents,
  displayName,
  { <react_children_property_name>: <slot_name> },
);

Which results in a children config like:

const BasicElementComponent = createComponent(
  window.React,
  elementName,
  BasicElement,
  basicElementEvents,
  displayName,
  {
    headIcons: 'head-icons',
    content: 'content',
    tailIcons: 'tail-icons',
  },
);

Tests are added to verify rendered elements are rendered with the correct slot names.

taylor-vann avatar Jun 02 '22 20:06 taylor-vann

🦋 Changeset detected

Latest commit: 05d4b5fa4eae1e70c74c3ac81e6f98faafbb2868

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jun 02 '22 20:06 changeset-bot[bot]

📊 Tachometer Benchmark Results

Summary

  • lit-element-list
  • lit-html-kitchen-sink
  • lit-html-repeat
  • lit-html-template-heavy
  • reactive-element-list

Results

tachometer-reporter-action v2 for Benchmarks

github-actions[bot] avatar Jun 02 '22 20:06 github-actions[bot]

Ugh dumb thumbs, how do I cancel this review ;_;

taylor-vann avatar Jun 03 '22 17:06 taylor-vann

Could I ask for why this is not being merged? Thank you. Do you need help to move this forward?

khanh-le-otsv avatar Feb 17 '23 03:02 khanh-le-otsv