Skip to content

How to use "children" of a custom component in solid-elements? #2140

Answered by onx2
onx2 asked this question in Q&A
Discussion options

You must be logged in to vote

I think I figured this out though I don't find it very ergonomic so if anyone has a better approach, I would love to hear it.

customElement(
  "wb-button",
  { variant: "one" },
  (props: WbButtonProps, { element }) => {
    return (
      <button>
        <style>{style}</style>
        <For each={element.childNodes}>{(child) => child}</For>
      </button>
    );
  }
);
<wb-button variant="asdf">
        <span>button</span>
        asdf
</wb-button>

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by onx2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant