dccLink: Link component

Description Usage Arguments Value Examples

View source: R/dccLink.R

Description

Link allows you to create a clickable link within a multi-page app. For links with destinations outside the current app, 'html.A' is a better component to use.

Usage

1
2
3
dccLink(children=NULL, id=NULL, href=NULL, refresh=NULL,
className=NULL, style=NULL, title=NULL, target=NULL,
loading_state=NULL)

Arguments

children

A list of or a singular dash component, string or number. The children of this component

id

Character. The ID of this component, used to identify dash components in callbacks. The ID needs to be unique across all of the components in an app.

href

Character. The URL of a linked resource.

refresh

Logical. Controls whether or not the page will refresh when the link is clicked

className

Character. Often used with CSS to style elements with common properties.

style

Named list. Defines CSS styles which will override styles previously set.

title

Character. Adds the title attribute to your link, which can contain supplementary information.

target

Character. Specifies where to open the link reference.

loading_state

Lists containing elements 'is_loading', 'prop_name', 'component_name'. those elements have the following types: - is_loading (logical; optional): determines if the component is loading or not - prop_name (character; optional): holds which property is loading - component_name (character; optional): holds the name of the component that is loading. Object that holds the loading state object coming from dash-renderer

Value

named list of JSON elements corresponding to React.js properties and their values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
if (interactive() && require(dash)) {
    library(dash)
    library(dashCoreComponents)
    library(dashHtmlComponents)

    app <- Dash$new()

    app$layout(htmlDiv(list(
              # represents the URL bar, doesn't render anything
              dccLocation(id = 'url', refresh=FALSE),
              dccLink('Navigate to "/"', href='/'),
              htmlBr(),
              dccLink('Navigate to "/page-2"', href='/page-2'),
              # content will be rendered in this element
              htmlDiv(id='page-content')
            )
        )
    )

    app$callback(output=list(id='page-content', property='children'),
                 params=list(
              input(id='url', property='pathname')),
              function(pathname) {
              paste0('You are on page ', pathname)
              }
    )

  app$run_server()
}

dashCoreComponents documentation built on July 1, 2020, 8:20 p.m.