using formAssociated in a Solid web component

Can someone point me to an example of a Solid web component that uses formAssociated to contribute values in form submissions?
4 Replies
bigmistqke
bigmistqke2mo ago
it's a bit long since u posted, but mb @Joe Pea can help
mvolkmann
mvolkmannOP2mo ago
@Joe Pea Can you point me to any example of a web component implemented with Solid that uses formAssociated to contribute values in form submissions? I'm writing a book on web components. An entire chapter is devoted to Solid. I have shown how to do this using other web component libraries and want to show the same for Solid.
Joe Pea
Joe Pea2mo ago
solid-element doesn't have an API for that, but it gives you the element reference, so perhaps you can attachInternals natively:
customElement('my-component', {someProp: 'one', otherProp: 'two'}, (props, { element }) => {
const internals = element.attachInternals()

// ...use internals

// ... Solid code
})
customElement('my-component', {someProp: 'one', otherProp: 'two'}, (props, { element }) => {
const internals = element.attachInternals()

// ...use internals

// ... Solid code
})
bigmistqke
bigmistqke2mo ago
if you are writing about web components in solid you should also have a look at https://github.com/lume/element it's the most worked through and maintained integration of solid with web components

Did you find this page helpful?