Skip to content

Commit 38b162e

Browse files
committed
Update tippy vignette on custom inputs
1 parent 3aae9a3 commit 38b162e

3 files changed

Lines changed: 75 additions & 0 deletions

File tree

inst/WORDLIST

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ htmlDependency
1010
javascript
1111
reactable
1212
customizable
13+
Codecov
14+
tooltips

vignettes/tutorial/custom-inputs.rmd

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Supported types for now:
1616
- dropdown: `dropdown_extra`
1717
- date: `date_extra`
1818
- checkbox: `checkbox_extra`
19+
- tooltips: `tooltip_extra`
1920

2021
It's possible to apply additional styling to your inputs by passing `class` argument:
2122

@@ -161,3 +162,75 @@ updateReactable(
161162
)
162163
)
163164
```
165+
166+
167+
You can also use `{tippy}` to add tooltips to your reactable columns:
168+
169+
```R
170+
library(shiny)
171+
library(reactable)
172+
library(reactable.extras)
173+
string_list <- function(values) {
174+
paste0(
175+
"{", paste0(names(values), " : ", unlist(values), collapse = ", "), "}"
176+
)
177+
}
178+
179+
df <- MASS::Cars93[, 1:4]
180+
df$Date <- sample(seq(as.Date("2020/01/01"),
181+
as.Date("2023/01/01"),
182+
by = "day"),
183+
nrow(df))
184+
df$Check <- sample(c(TRUE, FALSE), nrow(df), TRUE)
185+
186+
shinyApp(
187+
ui = fluidPage(
188+
reactable.extras::reactable_extras_dependency(),
189+
reactable_extras_ui("table"),
190+
hr(),
191+
textOutput("date_text"),
192+
textOutput("button_text"),
193+
textOutput("check_text"),
194+
textOutput("dropdown_text"),
195+
textOutput("text")
196+
),
197+
server = function(input, output) {
198+
reactable_extras_server(
199+
"table",
200+
data = df,
201+
columns = list(
202+
Manufacturer = colDef(
203+
header = tooltip_extra("tooltip", content = "Manufacturer type"), #tooltip
204+
cell = button_extra("button", class = "button-extra")
205+
),
206+
Check = colDef(
207+
header = tooltip_extra("tooltip", content = "Checkbox"),
208+
cell = checkbox_extra("check", class = "checkbox-extra"),
209+
align = "left"
210+
),
211+
Date = colDef(
212+
header = tooltip_extra("tooltip", content = "Date input"),
213+
cell = date_extra("date", class = "date-extra")
214+
),
215+
Type = colDef(
216+
header = tooltip_extra("tooltip", content = "Type dropdown"),
217+
cell = dropdown_extra(
218+
"dropdown",
219+
unique(df$Type),
220+
class = "dropdown-extra"
221+
)
222+
),
223+
Model = colDef(
224+
header = tooltip_extra("tooltip", content = "Model input"),
225+
cell = text_extra(
226+
"text"
227+
)
228+
)
229+
)
230+
)
231+
})
232+
233+
```
234+
235+
![](images/tooltips.gif)
236+
101 KB
Loading

0 commit comments

Comments
 (0)