Coder Social home page Coder Social logo

gotop's Introduction

CRAN status Grand total R-CMD-check LinkedIn

gotop

Add a scroll back to top in R Markdown and Shiny

See live demo{.btn .btn-primary .btn role="button"}

Install

Install the released version from CRAN.

install.packages("gotop")

To get a bug fix, or use a feature from the development version, you can install it from GitHub.

# install.packages("remotes")
remotes::install_github("lgnbhl/gotop")

RMarkdown

To add a scroll up icon in a R Markdown document, simply add use_gotop() inside a R code chunk with {r, echo = FALSE} so the code will not be shown in the final document.

gotop::use_gotop()

Shiny

To use it in Shiny, call use_gotop() inside the UI.

library(shiny)
library(gotop)

shinyApp(
  ui = fluidPage(
    align = "center",
    use_gotop(use_cdn = FALSE), # add it inside the ui
    h2("Shiny with gotop"), 
    HTML(rep("&darr;<br/><br/>scroll down<br/><br/>", 20)),
    textOutput("lookright")
  ),
  server = function(input, output, session){
    output$lookright <- renderText({ print("Look right") })
  }
)

Customize it

You can replace the default Font Awesome chevron up icon (“fas fa-chevron-up”) by any other Font Awesome icon, change its color, width and much more (run ?use_gotop() to see the documentation).

gotop::use_gotop(
  src = "fas fa-chevron-circle-up", # css class from Font Awesome
  color = "tomato", # color
  opacity = 0.8, # transparency
  width = 30, # size
  appear = 100 # number of pixels before appearance
  )

gotop's People

Contributors

gf-fluginbuhl avatar lgnbhl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gotop's Issues

The package doesn't work

Hi,

Thank you for creating this very useful package. However, it doesn't work on my end. My code is

knitr::kable(head(mtcars, 10))
gotop::use_gotop(
  src = "fas fa-chevron-circle-up", 
  color = "tomato", 
  width = 30
  )

However, there has no icons in the output html file.
Screen Shot 2020-10-22 at 11 56 53 AM

Please help me out. Thanks!

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.