Giter Site home page Giter Site logo

Comments (3)

tcbegley avatar tcbegley commented on June 1, 2024

Hi @multimeric,

Thanks for raising this. The data attribute you're referring to is indeed how Bootstrap JS works. However because Plotly Dash and all component libraries are built on React, the underlying implementation is quite different. In particular, this library is built on top of React-Bootstrap. You can see how Tooltips work here, and you'll notice it's quite different.

The ID / target pattern was arrived taking into account various constraints including limitations of Dash itself (some of which have been addressed since the first version of this library came out), and the way things are implemented in Reactstrap (a different React library with Bootstrap components that was originally the basis for dbc).

I'm open to alternative patterns that make things easier, as long as changes are backwards compatible.

Regarding your two suggestions, they both suffer from a major problem which is that I don't see how we could implement either option in a way that doesn't only work for components in this library. E.g. suppose I wanted to add a tooltip to a html.Div. We can target a particular id, but we don't have the ability to add a custom prop, nor do I see atm how we could search the whole tree of components for those data attributes.

from dash-bootstrap-components.

multimeric avatar multimeric commented on June 1, 2024

Okay, I see your point. From looking at the React Bootstrap docs, I wonder if adapting the following would be okay:

  const Link = ({ id, children, title }) => (
    <OverlayTrigger overlay={<Tooltip id={id}>{title}</Tooltip>}>
      <a href="#">{children}</a>
    </OverlayTrigger>

It's true that they use id here, but I don't think it's mandatory. We could call the Link element something more appropriate.

from dash-bootstrap-components.

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.