Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete children prop when used in markup #2500

Open
theetrain opened this issue Sep 12, 2024 · 0 comments
Open

Autocomplete children prop when used in markup #2500

theetrain opened this issue Sep 12, 2024 · 0 comments

Comments

@theetrain
Copy link

Description

When authoring a component and using the {children} reserved name, it would be nice to have this prop extracted from $props() automatically.

Proposed solution

As you author the body of a component:

<button>{children}</button>
<!--      ^ cursor is here after typing `c` -->

An autocomplete suggestion appears to extract children from $props(). Upon hitting ENTER, the autocomplete provides the prop and @render syntax:

<script>
  let { children } = $props()
</script>

<button>{@render children()}</button>

And if other props are already destructured, it will intelligently append children to the list of destructured props.

Alternatives

No response

Additional Information, eg. Screenshots

Relates to #2499.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant