user10012
user10012

Reputation: 715

Passing Objects as Props Inline

Is something like this possible in Svelte?

<CustomElement props={ {akey: `value`, bkey: `value`} }></CustomElement>

I know I can pass the object if I have defined it in the script, but some components I just need to send a couple static properties.

Upvotes: 0

Views: 668

Answers (1)

brunnerh
brunnerh

Reputation: 184376

In Svelte files this is possible.
In HTML with components compiled to custom elements this probably will not work, as all HTML attributes are strings.

Upvotes: 1

Related Questions