Format tab icon size in R flexdashboard - flexdashboard

I've built an R flexdasboard with tabs. I've added icons to the dashboard with:
a_tab_name {data-icon="fa-calendar"}
=====================================
I would like to increase the size of the icon. This can be done in a Shny app with
icon("calendar", "fa-3x")
which would cause the "calendar" icon in the "fa" icon library to be rendered 3x default size.
is it possible to do this in the flexdashboad tab syntax?

You can just add some inline CSS to the .active attribute. Using CSS font-size control.
---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
```
<style>
.active {
font-size:25px;
}
</style>
a_tab_name {data-icon="fa-calendar"}
=====================================
Column {data-width=350}
-----------------------------------------------------------------------
### Chart B
```{r}
```
### Chart C
```{r}
```
Before...
After...

Related

Shiny Dashboard - How to place an image from www folder into a dashboard box

I am looking for a simple method to retrieve a .png from a file folder, and place it in a shiny dashboard. I tried the suggested img(src='myImage.png', align = "right") from Embedding Image in Shiny App but I continue to get an error "unused arguments (src = "Slide1.PNG", align = "right")". I've tried to place my image in a dashboard, box, etc. without success.
You should show your code so that someone can review and point out issues in your usage. It really depends on where you want to place your image. The solution you pointed to shows you how to place an image in the main panel. The code below shows how to place an image in the header Title or to the right of title.
dashboardHeader(title = div("Testing",
img(src = 'YBS.png',
title = "A Clinical Graphics Application", height = "30px"),
style = "position: relative; margin:-3px 0px 0px 5px; display:right-align;"
),
titleWidth=450,
tags$li(div(
img(src = 'YBS.png',
title = "A Clinical Graphics Application", height = "30px"),
style = "padding-top:10px; padding-right:100px;"),
class = "dropdown"),...
In a tabBox the following should work
div(tags$img(height="50px", src="YBS.png", style="text-align: right;"))

how to set background color of ion content

I want to set background color of whole app or a single background color
but what happened if i use div , different device take different height that's why bottom side not cover up and i am unable to set ion content background.
Add below code to your app.scss file :
html, body, ion-app, ion-content, ion-page, ion-view, .nav-decor {
background-color: #yourColor !important;
}
Bro u can use in this case i have a stylesheet global with primary color variable

Dynamically setting max-height of Bootstrap modal body

I'm trying to dynamically set the max-height of Bootstraps modal-body elements for all modal dialog boxes. I've written the following, which seems to work when the dialog is opened. I'm depending on the enforceFocus method to exist and to be called once the dialog is rendered. I realize there may be moment before the CSS property is set where the dialog will not be rendered exactly right, but I'm okay with that. Is there anything wrong with this solution? I know I have yet to account for resizing the screen with a modal open, but that seems the easier problem to solve.
(function ($) {
$.fn.modal.Constructor.DEFAULTS.backdrop = 'static';
$.fn.modal.Constructor.DEFAULTS.keyword = false;
var oldEnforceFocus = $.fn.modal.Constructor.prototype.enforceFocus;
$.fn.modal.Constructor.prototype.enforceFocus = function () {
oldEnforceFocus.call(this);
var $element = this.$element;
var maxHeight =
$("body").height() // full page
- $element.find(".modal-header").outerHeight(true) // modal header
- $element.find(".modal-footer").outerHeight(true) // modal footer
- ($element.find(".modal-dialog").outerHeight(true) - $element.find(".modal-dialog").height()) // dialog margins
- 5; // fudge factor
$element.find(".modal-body").css("max-height", maxHeight);
}
})(jQuery);
Thanks!
edit: To give credit where credit is due, this is based on
Correct way to extend Bootstrap Modal - lock, unlock.
If you don't want to use javascript, you can use CSS media queries and get close-ish to the height you need by using min-height. For example, define a media query on min-height: 540px, and set the max-height of the modal to something like max-height: 500px. Then define a media query at say min-height: 680px and set the modal to max-height: 640px. It's not fluid, and it requires several media queries to inch up to the largest size you want to plan for, but it will get you there.
#Josh solution is good with CSS and media queries but writing so many media queries where small devices has different screen heights e.g Iphone and SamSung G and N series, required alot of media queries to even calculate close-ish modal height on different screen sizes.
so setting height of modal (modal-body) dynamically according to media screen size and on small devices where there will be 2 types of media screen landscape and portrait, following few lines of code will put you very close-ish to your goal
Rendering modal HTML according to screen size with-in sec and later if screen size changes adjust it's height according to screen size
$(document).ready(function () {
setInterval(Dimension, 100);
function Dimension() {
var doc = $(document).height(); // document height
var head = $(".modal-header").height(); // modal header height
var footer = $(".modal-footer").height(); // modal footer height
var modheight = doc - head - footer - 65; // 65 is extra margins and it will not effect the height of modal any way if not changed.
$('.modal-body').css('height', modheight);
}
});
Note
Few Changes required in Modal CSS
CSS
.modal-dialog {
margin: 0px auto !important;
}
.modal-body {
overflow-y: scroll; // In-case the content in modal-body overflow so it will have scrolling.
}
Fiddle
You can check the modal height adjust itself by increasing and decreasing the fiddle result window's height and width.

How do I change the color of a link in Elm?

I create links for a website in Elm with Text.link "https://somewebsite.com" (toText "SomeWebsite"). I would like to be able to set the color of the resultant text.
I have tried Text.link "https://somewebsite.com" (Text.color white <|toText "SomeWebsite") and Text.color white <|Text.link "https://somewebsite.com" (toText "SomeWebsite"), neither of which work, despite that the type signature of link is link : String -> Text -> Text. Both of these snippets compile.
I've looked through the source of elm-lang.org, which has links that look like they've been styled (they seem to have a different color than the default dark blue and no underlines) and haven't found anything that explains how it's done there.
How can I color the text of links in Elm?
The following will create a link to google that is red:
import Text (..)
main = toText "Google"
|> style {defaultStyle | color <- red, height <- Just 20 }
|> link "http://google.com"
|> leftAligned
Live demo here.
Unfortunately, this does not give you the power to really "style" the link when you hover over it which is a bit of a bummer.
The elm-lang website has the following styles at the top of its pages:
<style type="text/css">
a:link {text-decoration: none; color: rgb(15,102,230);}
a:visited {text-decoration: none}
a:active {text-decoration: none}
a:hover {text-decoration: underline; color: rgb(234,21,122);}
body { font-family: "Lucida Grande","Trebuchet MS","Bitstream Vera Sans",Verdana,Helvetica,sans-serif !important; }
p, li { font-size: 14px !important;
line-height: 1.5em !important; }
</style>
This gives its links the styling you see there.
However, it is still possible to get this type of styling using customButton from Graphics.Input.
import Graphics.Input as Input
click = Input.input ()
linkFormat = { defaultStyle | color <- blue }
hoverFormat = { linkFormat | bold <- True }
customLink url text =
let text' = Text.toText text
regular = Text.style linkFormat text' |> leftAligned
hover = Text.style hoverFormat text' |> leftAligned
down = Text.style linkFormat text' |> leftAligned
in link url <| Input.customButton click.handle () regular hover down
main = customLink "http://google.com" "Google"
Live demo here.
One thing to notice here is that I am not using Text.link. I am just using the link function from Graphics.Element which is imported by default and has the type String -> Element -> Element.
I hope this helps!
This no longer works on Elm 0.13, btw. It first says link is ambiguous between the one in the Graphics lib and the Text.link, so I qualify it by prepending Text. to link and then it complains that it 'Could not find variable 'Text.link'.' Same thing happens when I qualify it as a Graphics.Element.link.
it seems weird that I would not be able to qualify something by adding the module qualifier to it in Elm 0.13.
To accomplish this in 0.13, I figured out you can do the below.
import Text
main = link "http://www.google.com" <| leftAligned <| Text.color red <| toText "Google"
http://share-elm.com/sprout/5430943ee4b017b21db2f86c
Demo in Elm-0.18
module Main exposing (main)
import Html as H exposing (Html)
import Html.Attributes as HA
main : Html msg
main =
H.a
[ HA.href "https://en.wikipedia.org"
, HA.style [ ( "color", "green" ) ]
]
[ H.text "wikipedia" ]

Rally API: How to print or export to pdf from Custom HTML

I have created table with data using "custom html app".
I want now print this page but when I try to do it, it cuts few last columns.
I have tried to set style of body to "width:1000px" and then it prints ok but then it doesn't shows on whole screen and I have table of size 1000px
We usually end up having slightly different css for printing than runtime.
Try this:
#media print {
body {
width: 1000px;
}
}