Merge pull request #171 from isteves/docs
add width = 100% to example
diff --git a/R/scroll_box.R b/R/scroll_box.R
index 44bd096..3d1b805 100644
--- a/R/scroll_box.R
+++ b/R/scroll_box.R
@@ -10,6 +10,20 @@
#' @param extra_css Extra CSS styles
#'
#' @export
+#'
+#' @examples
+#' \dontrun{
+#' # Specify table size by pixels
+#' kable(cbind(mtcars, mtcars), "html") %>%
+#' kable_styling() %>%
+#' scroll_box(width = "500px", height = "200px")
+#'
+#' # Specify by percent
+#' kable(cbind(mtcars, mtcars), "html") %>%
+#' kable_styling() %>%
+#' scroll_box(width = "100%", height = "200px")
+#' }
+
scroll_box <- function(kable_input, height = NULL, width = NULL,
box_css = "border: 1px solid #ddd; padding: 5px; ",
extra_css = NULL) {
diff --git a/man/scroll_box.Rd b/man/scroll_box.Rd
index a431fd0..440dcc5 100644
--- a/man/scroll_box.Rd
+++ b/man/scroll_box.Rd
@@ -22,3 +22,16 @@
This function will put a HTML kable object in a fixed-height,
fixed-width or both box and make it scrollable.
}
+\examples{
+\dontrun{
+# Specify table size by pixels
+kable(cbind(mtcars, mtcars), "html") \%>\%
+ kable_styling() \%>\%
+ scroll_box(width = "500px", height = "200px")
+
+# Specify by percent
+kable(cbind(mtcars, mtcars), "html") \%>\%
+ kable_styling() \%>\%
+ scroll_box(width = "100\%", height = "200px")
+}
+}