Giter Site home page Giter Site logo

Comments (6)

tcbegley avatar tcbegley commented on June 5, 2024 2

Thanks for the contribution! I made a new prerelease with your changes. Please try it and lmk if it solves your problem.

pip install dash-bootstrap-components==1.5.0rc4

from dash-bootstrap-components.

tcbegley avatar tcbegley commented on June 5, 2024 1

Hi @mapix

Thanks for the suggestion! I actually went ahead an implemented this independently as I didn't notice your final comment, sorry about that. You can see my changes in #971 and #973. You can also try it by installing the pre-release I made

pip install dash-bootstrap-components==1.5.0rc3

If you do try it with your app, I'd be keen to know how you get on.

There's a few differences with your implementation, including support for internal links, and making use of the as prop in Carousel.Item which means we don't have to create extra HTML elements that might interfere with Bootstrap's CSS.

I did however fail to implement the target attribute, if you want to submit a PR adding that to my changes I would accept such a change. lmk if you would be interested and think this could be a useful feature.

Here's an example I tested my changes with:

import dash_bootstrap_components as dbc
from dash import Dash, Input, Output, dcc, html

app = Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])

DBC_DOCS = "https://dash-bootstrap-components.opensource.faculty.ai/"
HOME_LAYOUT = dbc.Carousel(
    items=[
        {
            "key": "1",
            "src": f"{DBC_DOCS}/static/images/slide1.svg",
            "href": "https://google.com",
        },
        {
            "key": "2",
            "src": f"{DBC_DOCS}/static/images/slide2.svg",
            "href": "/internal",
        },
        {
            "key": "3",
            "src": f"{DBC_DOCS}/static/images/slide3.svg",
            "href": "/internal",
            "external_link": True,
        },
    ],
    controls=True,
    indicators=True,
)

app.layout = dbc.Container(
    [dcc.Location(id="url"), html.Div(id="contents")],
    class_name="p-5",
)


@app.callback(Output("contents", "children"), Input("url", "pathname"))
def navigate(pathname):
    if pathname == "/":
        return HOME_LAYOUT
    elif pathname == "/internal":
        return "Some internal page..."
    return "404: Not Found..."


if __name__ == "__main__":
    app.run_server(debug=True)

from dash-bootstrap-components.

mapix avatar mapix commented on June 5, 2024 1

@tcbegley

1.5.0rc3 looks good, but in my scenario, Carousel is in a Portal page, and it needs to be used to navigate multiple times to the sub applications. Therefore, customization of the target attribute is necessary. I added this attribute in #975 .

from dash-bootstrap-components.

mapix avatar mapix commented on June 5, 2024 1

@tcbegley
It works, Thank you very much !!!

from dash-bootstrap-components.

tcbegley avatar tcbegley commented on June 5, 2024

Great! Will make a full release in the next few days

from dash-bootstrap-components.

tcbegley avatar tcbegley commented on June 5, 2024

These changes are now in the latest release.

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.