Python dash_core_components.Link() Examples

The following are 8 code examples of dash_core_components.Link(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module dash_core_components , or try the search function .
Example #1
Source File: multi-page-dropdown.py    From dash-recipes with MIT License 6 votes vote down vote up
def display_page(pathname):
    return html.Div([
        html.Div([
            html.Span(
                dcc.Link(link_mapping['/'], href="/") if pathname != '/' else 'Exhibit A',
                style=styles['link']
            ),

            html.Span(
                dcc.Link(link_mapping['/exhibit-b'], href="/exhibit-b") if pathname != '/exhibit-b' else 'Exhibit B',
                style=styles['link']
            ),

            html.Span(
                dcc.Link(link_mapping['/exhibit-c'], href="/exhibit-c") if pathname != '/exhibit-c' else 'Exhibit C',
                style=styles['link']
            )

        ]),

        dcc.Markdown('### {}'.format(link_mapping[pathname])),
    ]) 
Example #2
Source File: multi_page.py    From dash-recipes with MIT License 6 votes vote down vote up
def display_page(pathname):
    print(pathname)
    if pathname == '/':
        return html.Div([
            html.Div('You are on the index page.'),

            # the dcc.Link component updates the `Location` pathname
            # without refreshing the page
            dcc.Link(html.A('Go to page 2 without refreshing!'), href="/page-2", style={'color': 'blue', 'text-decoration': 'none'}),
            html.Hr(),
            html.A('Go to page 2 but refresh the page', href="/page-2")
        ])
    elif pathname == '/page-2':
        return html.Div([
            html.H4('Welcome to Page 2'),
            dcc.Link(html.A('Go back home'), href="/"),
        ])
    else:
        return html.Div('I guess this is like a 404 - no content available')

# app.css.append_css({"external_url": "https://codepen.io/chriddyp/pen/bWLwgP.css"}) 
Example #3
Source File: run.py    From dash-docs with MIT License 6 votes vote down vote up
def create_backlinks(pathname):
    parts = pathname.strip('/').split('/')
    links = [
        dcc.Link('Home', href='/')
    ]
    for i, part in enumerate(parts[:-1]):
        href='/' + '/'.join(parts[:i + 1])
        name = chapter_index.URL_TO_BREADCRUMB_MAP.get(href, '? {} ?'.format(href))
        links += [
            html.Span(' > '),
            dcc.Link(name, href=href)
        ]
    current_chapter_name = chapter_index.URL_TO_BREADCRUMB_MAP.get(
        pathname.rstrip('/'), '? {} ?'.format(pathname)
    )
    links += [html.Span(' > ' + current_chapter_name)]
    return links 
Example #4
Source File: Chapter.py    From dash-docs with MIT License 6 votes vote down vote up
def Chapter(name, href=None, caption=None):
    linkComponent = html.A if href.startswith('http') else dcc.Link
    return html.Div(className='toc--chapter', children=[
        html.Li(
            linkComponent(
                name,
                href=relpath(href),
                id=href,
                className='toc--chapter-link'
            ),
        ),
        html.Small(
            className='toc--chapter-content',
            children=Markdown(caption or ''),
            style={
                'display': 'block',
                'marginTop': '-10px' if caption else ''
            }
        ) if caption else None
    ]) 
Example #5
Source File: app.py    From lantern with Apache License 2.0 6 votes vote down vote up
def get_menu():
    menu = html.Div([

        dcc.Link('Overview   ', href='/overview', className="tab first"),

        dcc.Link('Price Performance   ', href='/price-performance', className="tab"),

        dcc.Link('Portfolio & Management   ', href='/portfolio-management', className="tab"),

        dcc.Link('Fees & Minimums   ', href='/fees', className="tab"),

        dcc.Link('Distributions   ', href='/distributions', className="tab"),

        dcc.Link('News & Reviews   ', href='/news-and-reviews', className="tab")

    ], className="row ")
    return menu

## Page layouts 
Example #6
Source File: Sidebar.py    From dash-docs with MIT License 5 votes vote down vote up
def Sidebar(urls, depth=0):

    chapters = []
    for chapter in urls:
        try:
            if 'chapters' in chapter and not chapter.get('hide_chapters_in_sidebar', False):
                chapters.append(Collapsible(
                    chapter['name'],
                    Sidebar(chapter['chapters'], depth+1),
                    chapter.get('description', None)
                ))
            else:
                title = ''
                if isinstance(chapter.get('description'), str):
                    title = dedent(chapter['description']).strip()
                elif isinstance(chapter.get('description_short'), str):
                    title = dedent(chapter['description_short']).strip()

                chapters.append(html.Div(
                    dcc.Link(
                        chapter['name'],
                        href=chapter['url'].rstrip('/'),
                    ),
                    className='link',
                    **(
                        {'title': title}
                        if not title == '' else {}
                    )
                ))
        except Exception as e:
            print(e)

    return html.Div(
        className='sidebar sidebar--{}'.format(depth),
        children=chapters
    ) 
Example #7
Source File: components.py    From slapdash with MIT License 5 votes vote down vote up
def make_brand(**kwargs):
    return html.Header(
        className="brand",
        children=dcc.Link(
            href=get_url(""),
            children=html.H1([fa("far fa-chart-bar"), server.config["TITLE"]]),
        ),
        **kwargs,
    ) 
Example #8
Source File: app.py    From lantern with Apache License 2.0 5 votes vote down vote up
def get_logo():
    logo = html.Div([

        html.Div([
            html.Img(src='http://logonoid.com/images/vanguard-logo.png', height='40', width='160')
        ], className="ten columns padded"),

        html.Div([
            dcc.Link('Full View   ', href='/full-view')
        ], className="two columns page-view no-print")

    ], className="row gs-header")
    return logo