ember-paper
ember-paper copied to clipboard
Add input with tooltip
#1087 Adds input with tooltip
- Adds tooltips to input;
- Adds input with tooltip to demo;
- Adds tests for input with tooltip;
All of this would be solved if we had named blocks instead of a single block. This way we could customize the label with whatever content we want, including an icon + tooltip.
Since named blocks are not a reality, my suggestion is that we accept a labelComponent
argument, which paper-input would render if truthy.
Example:
{{paper-input
labelComponent=(component "tooltip-label" text="myLabel" tooltip="My tooltip")
value=myValue
onChange=(action (mut myValue))
}}
In the paper-input.hbs
template, we would do something like:
{{#if labelComponent}}
{{component labelComponent inputElementId=inputElementId required=required}}
{{else if label}}
<label for={{inputElementId}} class={{if required "md-required"}}>{{label}}</label>
{{/if}}
In this case, you could have your own tooltip-label
component in which you could do all sorts of crazy stuff.
I can't merge this PR the way it is now because it's too specific. It assumes that people want an info icon, etc.
Let me know what you think.
I agree that providing a custom labelComponent will be cleaner and more versatile. I'll change it up soon enough