Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reactable affects height of all cards containing reactable in quarto dashboard #382

Open
wvictor14 opened this issue Jul 10, 2024 · 1 comment

Comments

@wvictor14
Copy link

I suspect this has something to do with css / html which my knowledge is quite rudimentary. I also am not sure if this would be more appropriate to ask in quarto or somewhere else e.g. for html/css specific advice. Let me know if this is not appropriate to ask for help here!

Description of the problem:

I expect that in quarto documents, a reactable with expandable rows in card 1 will control card 1's height when rows are expanded. However, I noticed if I have another card (call it card 2) with another reactable,  then it's height will also expand, even though it is a distinct reactable.

Here is a MRE:

---
title: "test"
format: 
  dashboard:
    scrolling: true
editor_options: 
  chunk_output_type: console
---

## Row 

```{r}
library(reactable)
library(dplyr)
library(htmltools)
data <- unique(CO2[, c("Plant", "Type")])

make_rt <- function(x, ...) {
  reactable(
    x,
    details = function(index) {
      plant_data <- CO2[CO2$Plant == data$Plant[index], ] |> 
        slice(1:2)
      htmltools::div(style = "padding: 1rem",
                     reactable(plant_data, outlined = TRUE)
      )
    },
    ...
  )
}

data |>  slice(1:3) |>   make_rt(class = 'table-1')
```


## Row

```{r}
data |>  slice(3:6) |>   make_rt(class = 'table-2')
```

collapsed rows:
image

Expanding rows in reactable 1 increase both card 1 and card 2 height

image

But I don't want card 2 to expand when card 1 reactable is interacted with obviously.

@glin
Copy link
Owner

glin commented Jul 22, 2024

Hi, I'm not real familiar with Quarto dashboards, but just looking at the CSS of the cards, it looks like it's just how the cards work. They're styled so each card always has the same height. I'm not sure if this can be changed or if there's an alternate way to do cards, but it'd probably be a better question for someone more familiar with Quarto dashboards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants