-
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
The existing <Popper />
component doesn't feel right, it does absolutely nothing, if not allow the consumers to pass props down and retrieve the result.
The README example could be written as follows and everything would still work:
<Popper
reference={referenceElement}
popper={popperElement}
options={popperOptions}
bind:styles
bind:attributes
/>
<button bind:this={referenceElement}>Reference Element</button>
<div
bind:this={popperElement}
class="tooltip"
style={css(styles.popper)}
{...attributes.popper}>
Popper Element
<div bind:this={arrowElement} class="arrow" style={css(styles.arrow)} />
</div>
A cleaner approach could be the use:action
API.
<script>
let styles = {};
let attributes = {};
</script>
<button
use:popper={{ popperElement, options }}
on:popperUpdate={evt => {
styles = evt.detail.styles;
attributes = evt.detail.attributes;
}}
>
Reference Element
</button>
Here's a basic example:
https://codesandbox.io/s/trusting-butterfly-704gd?file=/popperAction.js
Thoughts?
TylerRick, MathieuDoyon, Abourass, supposedly, fpauser and 4 more
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed