Giter Site home page Giter Site logo

manual open/close? about tooltips HOT 7 CLOSED

svelte-plugins avatar svelte-plugins commented on July 17, 2024
manual open/close?

from tooltips.

Comments (7)

dysfunc avatar dysfunc commented on July 17, 2024 1

I had that thought initially. I could combine all of them so everything is out there. You can be explicit with events or control behavior via callbacks

from tooltips.

ogrotten avatar ogrotten commented on July 17, 2024 1

One of the things I dislike about github is that notifications are very out of the way. I'm always missing stuff.

This looks fabulous thanks for your work!

from tooltips.

dysfunc avatar dysfunc commented on July 17, 2024

I'll add this feature request to the next release.

Feature Description
Expose two new interface properties that define the showAction and hideAction of a tooltip. These properties will accept one of the following DOM event assignments:

  • showAction: click, mousedown, mouseenter.
  • hideAction: click, mouseout, mouseleave.

from tooltips.

ogrotten avatar ogrotten commented on July 17, 2024

That's pretty cool and useful.

Might it be simpler to make methods that you could call using svelte/html events? That way it can be dealt with directly.

like for example

<div on:mouseleave|stopPropagation={() => tooltip.close()} />

open/close methods could then be used in non-tooltip situations... like for example a ux/ui tutorial, where they'd be fired on elements in a certain order, but only because $: if (tutorialStep === 3)

from tooltips.

ogrotten avatar ogrotten commented on July 17, 2024

That sounds great. Thanks and well done.

from tooltips.

dysfunc avatar dysfunc commented on July 17, 2024

After thinking about it, I'm just going to make the show prop bindable and you can control the initial or close behavior by just setting that to true or false

from tooltips.

dysfunc avatar dysfunc commented on July 17, 2024

you'll have something like this now

<script>
  import { Tooltip } from '@svelte-plugins/tooltips';
  
  let isVisible = false;
  
  const hideOnClick = () => (isVisible = false);
</script>

<p>
 This tooltip should appear to the
  <Tooltip
    bind:show={isVisible}
    action="click"
    align="center"      
    content="I should appear to the right."
    position="right">
    <b>right</b>
  </Tooltip>
  when clicked.
</p>

<button on:click={hideOnClick}>Close the tooltip</button>

from tooltips.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.