-
Notifications
You must be signed in to change notification settings - Fork 9
Closed as not planned
Closed as not planned
Feature
Copy link
Milestone
Description
Problem
Today, the end-user must pass inputs into the web component by storing a reference to it and setting properties on it before passing the ref as a prop.
This is a lot of boilerplate code for the end-user to write.
Solution
Configure the web component to accept Object props. This would reduce the amount of boilerplate code that the end user must write.
<svelte:options
customElement={{
tag: 'invoice-dashboard',
props: {
config: { type: 'Object' },
wallet: {type: 'Object' },
requestnetwork: { type: 'Object', attribute: 'request-network' },
},Definition of Done
- Update the READMEs and documentation
Reference
https://svelte.dev/docs/custom-elements-api#component-options
- props: an optional property to modify certain details and behaviors of your component's properties. It offers the following settings:
- attribute: string: To update a custom element's prop, you have two alternatives: either set the property on the custom element's reference as illustrated above or use an HTML attribute. For the latter, the default attribute name is the lowercase property name. Modify this by assigning attribute: "".
- reflect: boolean: By default, updated prop values do not reflect back to the DOM. To enable this behavior, set reflect: true.
- type: 'String' | 'Boolean' | 'Number' | 'Array' | 'Object': While converting an attribute value to a prop value and reflecting it back, the prop value is assumed to be a String by default. This may not always be accurate. For instance, for a number type, define it using type: "Number" You don't need to list all properties, those not listed will use the default settings.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
✅ Done