Skip to content

Add support for Lit-style lowercase props #16

@patricknelson

Description

@patricknelson

For feature parity with Svelte 4.0 (and simply to enable the availability of uppercased props in custom element attributes), we should standardize on Lit-style attributes, per sveltejs/svelte#8457 (emphasis mine):

... and what the corresponding attribute for the property is (attribute, default lowercased prop name). These options are heavily inspired by lit: https://lit.dev/docs/components/properties.

e.g.

<custom-element foobar="baz></custom-element>

Where the element attribute foobar is automatically translated to its camelCase counterpart: fooBar, making it available in CustomElement.svelte as:

<script>
  export let fooBar = '';
</script>

<div>{fooBar}</div>

This should supersede the prior request to support kebab-style to camelCase conversions (issue #11), since that is apparently not the direction that Svelte 4 will be going. Sticking with Svelte's choice should make it easier for someone to migrate, if necessary. Just setting up this issue so I can track it and implement it when able.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions