paper-input icon indicating copy to clipboard operation
paper-input copied to clipboard

suffix slot for paper-textarea

Open govis opened this issue 8 years ago • 3 comments

Description

Just wondering if it would be possible to add a suffix slot in the paper-textarea element. This would allow us to put a drop-down icon there to mimic the look of the paper-input in paper-dropdown-menu (for a nested path selection element using paper-textarea and its autogrow feature). It's a bit onerous to keep tweaking paper-textarea.html with this little thing.

Expected outcome

image

Actual outcome

image

Live Demo

<slot name="suffix" slot="suffix"></slot>

Steps to reproduce

N/A

Browsers Affected

  • [ ] Chrome
  • [ ] Firefox
  • [ ] Safari 9
  • [ ] Safari 8
  • [ ] Safari 7
  • [ ] Edge
  • [ ] IE 11
  • [ ] IE 10

govis avatar Feb 01 '17 20:02 govis

There was a PR that tried to do this, but it became inactive. Maybe you want to finish it off? https://github.com/PolymerElements/paper-input/pull/203. From what i remember, the only problem was the alignment of the prefix/suffix (middle instead of bottom)

notwaldorf avatar Feb 01 '17 20:02 notwaldorf

Sure, I could give it a try to align it to the bottom

govis avatar Feb 02 '17 02:02 govis

So I looked through the code and aligning to the bottom should be fairly easy to do, but paper-input-container would need to be tweaked a bit.

Basically there's two ways to do it:

  1. Apply --layout-self-end onto the the wrapper span: <span class="suffix"><slot name="suffix"></slot></span>. This would require another custom property in addition to already existing --paper-input-suffix, something like
.suffix {
    @apply --paper-input-suffix-container;
}

But I think that people may question the need for two --paper-input-suffix(-xxx) properties.

  1. I don't really get the need for the wrapper span so we can remove it and apply the style onto the slotted content directly:
.input-wrapper ::slotted([slot=suffix]) {
    display: inline-block;
    @apply --paper-font-subhead;
    @apply --layout-flex-none;

    @apply --paper-input-suffix;
}

The client code would then have something like that:

paper-textarea {
    --paper-input-suffix: {
        @apply --layout-self-end;
    };
}

I think the latter approach is cleaner, but I maybe missing something about those wrapper spans, so could you please advise as to which way would be preferable.

image

govis avatar Feb 03 '17 16:02 govis