very quick question : how can I set text passed to the shiny.fluent::Text
function to render bold ? more generally, how to pass styling options to this function ?
快速问题:如何将传递给shiny.fluent::Text函数的文本设置为粗体?更广泛地说,如何将样式选项传递给此函数?
In the help page of the function, it is written
在函数的帮助页面中,它是这样写的
You can specify the variant prop to apply font styles to Text. This variant pulls from the Fluent UI React theme loaded on the page.
but I don't understand how to use this variant
parameter.
但我不明白如何使用这个变量参数。
I have tried setting class=ms-fontWeight-bold
at different places and play with the variant
parameter but I found nothing working...
我试着在不同的地方设置class=ms-fontWeight-bold,并尝试使用变量参数,但我发现什么都不起作用...
Sorry, surely newbie's question but I am new to Fluent and I find the shiny.fluent
package quite poorly documented (maybe because I am too unexperienced...)...
对不起,当然是新手的问题,但我对流利是个新手,我发现这个闪亮流利的包记录得很少(可能是因为我太没有经验了……)。
Thanks in advance for any help
事先感谢您的帮助
Reproducible example :
可重现的例子:
library(shiny)
library(shiny.fluent)
ui <- fluentPage(
tags$style(".card { padding: 28px; margin-bottom: 28px; }"),
uiOutput("analysis")
)
server <- function(input, output, session) {
output$analysis <- renderUI({
Stack(
horizontal = TRUE,
tokens = list(childrenGap = 10),
div(
# << how can I set this text to be large ??????????????????
Text("Test", variant="large")# , class = "ms-fontWeight-bold" ### does not work
)
)
})
}
shinyApp(ui, server)
更多回答
优秀答案推荐
You can wrap the text to be displayed in a div
with the desired class:
您可以使用所需的类将要在div中显示的文本换行:
library(shiny)
library(shiny.fluent)
ui <- fluentPage(
tags$style(".card { padding: 28px; margin-bottom: 28px; }"),
uiOutput("analysis")
)
server <- function(input, output, session) {
output$analysis <- renderUI({
Stack(
horizontal = TRUE,
tokens = list(childrenGap = 10),
div(
Text(
"Test",
variant = "large"
)
),
div(
Text(
div(
class = "ms-fontWeight-bold",
"Test"
),
variant = "large"
)
)
)
})
}
shinyApp(ui, server)
更多回答
perfect :-) thanks a lot, I definitely need to improve my html skills...
完美:-)非常感谢,我绝对需要提高我的html技能…
我是一名优秀的程序员,十分优秀!