Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Suggestion: Comments in the middle of attribute lists #6087

Copy link
Copy link
Closed
@CherryDT

Description

@CherryDT
Issue body actions

Is your feature request related to a problem? Please describe.
In the case of complex components which take a ton of attributes (something like a generic CrudForm or things like that) I usually split them up to one per line. In this case it would sometimes be useful to add comments to specific attributes to explain something about them. Right now there is no way (that I know of) to add any sort comment in the middle of an attribute list.

Describe the solution you'd like
I would like to be able to add comments of some sort in the middle of an attribute list, for example:

<ComplexComponent
  stuff1="stuff1"
  stuff2="STUFF2" <<< I'd like to write something about why stuff2 is uppercase here
  stuff3="stuff3"
/>

An idea of how this could look would be to use {/* ... */} as syntax (and in extension to allow, albeit meaningless, {} and just emit a warning for it - right now it crashes, see #6086):

<ComplexComponent
  stuff1="stuff1"
  stuff2="STUFF2" {/* stuff2 needs to be uppercase because reasons */}
  stuff3="stuff3"
/>

Open to better ideas of course...

Describe alternatives you've considered
One alternative would be to pass props using {...{a: 'a', b: 'b'}} instead of a="a" b="b" (which is a JS expression and therefore allows /* ... */ in the middle), but that means that it looks and behaves differently from other usages of attributes, so it's not ideal. Also, you can't do that with bind:x, let:x, on:x or slot then.

<ComplexComponent {...{
  stuff1: 'stuff1',
  stuff2: 'STUFF2' // stuff2 needs to be uppercase because reasons
  stuff3: 'stuff3'
}} />

The way I currently use is {...{/* comment */}} which works but is ugly of course.

<ComplexComponent
  stuff1="stuff1"
  stuff2="STUFF2" {...{/* stuff2 needs to be uppercase because reasons */}}
  stuff3="stuff3"
/>

How important is this feature to you?
Not that important, just a nice-to-have

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.