Good afternoon!
I'm looking to change the layout of the sortable::bucket_list from the first picture to something akin to the second. I'm a bit lost
Current App Layout
Prefered Layout
library(shiny)
library(tidyverse)
library(sortable)
playerPositions <- tibble(
player = paste0("Player #",rep(1:22)),
position = rep(c("GK", "LFB", "LCB", "RCB", "RFB", "CM", "LAM", "RAM", "LWAM", "RWAM", "FWD"), 2)
)
#UI ----
ui <- fluidPage(
titlePanel("Soccer Positions"),
uiOutput(outputId = 'position.buck.list')
)
#Server -----
server <- function(input, output, session) {
output$position.buck.list <- renderUI({
bucket_list(
header = "Drag the athlete to desired position",
group_name = "position.chart",
orientation = "horizontal",
add_rank_list(
text = "GK",
labels = as.list(playerPositions %>% filter(position == 'GK') %>% pull(player)),
input_id = "GK"
),
add_rank_list(
text = "LFB",
labels = as.list(playerPositions %>% filter(position == 'LFB') %>% pull(player)),
input_id = "LFB"
),
add_rank_list(
text = "LCB",
labels = as.list(playerPositions %>% filter(position == 'LCB') %>% pull(player)),
input_id = "LCB"
),
add_rank_list(
text = "RCB",
labels = as.list(playerPositions %>% filter(position == 'RCB') %>% pull(player)),
input_id = "RCB"
),
add_rank_list(
text = "CM",
labels = as.list(playerPositions %>% filter(position == 'CM') %>% pull(player)),
input_id = "CM"
),
add_rank_list(
text = "LAM",
labels = as.list(playerPositions %>% filter(position == 'LAM') %>% pull(player)),
input_id = "LAM"
),
add_rank_list(
text = "RAM",
labels = as.list(playerPositions %>% filter(position == 'RAM') %>% pull(player)),
input_id = "RAM"
),
add_rank_list(
text = "LWAM",
labels = as.list(playerPositions %>% filter(position == 'LAM') %>% pull(player)),
input_id = "LWAM"
),
add_rank_list(
text = "RWAM",
labels = as.list(playerPositions %>% filter(position == 'LAM') %>% pull(player)),
input_id = "RWAM"
),
add_rank_list(
text = "FWD",
labels = as.list(playerPositions %>% filter(position == 'FWD') %>% pull(player)),
input_id = "FWD"
)
)
})
}
shinyApp(ui = ui, server = server)