Skip to content

Pre-RFC: Splat Areas #517

@knownasilya

Description

@knownasilya

Based on https://mobile.twitter.com/knownasilya/status/1152293795901464577

With the addition of ...attributes, element modifiers and having multiple top elements in a glimmer component, it has become obvious that ...attributes is too limited (I'm sure the API was mean't to be simple while patterns emerge). Think of a component that wraps an input and a label into a nice package. Currently you'd need to either have the user yield out subcomponents and recreate the same structure or provide custom arguments for each element/component.

What if we could expose elements/components for customization by name, for example:

<UserCard
  @user={{@user}}
  {{on 'click' this.openProfile}}
  [avatar
    class='avatar-sm'
    @size='small'
    {{on 'click' this.openAvatarModal}}
  ]
/>

And the user card would apply it like so:

<div ...attributes class='container'>
  <Avatar @img={{@user.avatar.url}} ...[avatar] class='avatar' />
  {{! more stuff here }}
</div>

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