I was able to figure out a solution simply using fluidrow, and column containers. Secondly, I didn't realize that if the group_name argument was the same for different bucket_lists() it would allow the names to be drug from list to list.
Please see a working solution below.
library(shiny)
library(tidyverse)
library(sortable)
athleteData <- tibble(
athleteName = paste0("Player #",rep(1:22)),
athletePosition = rep(c("GK", "FB-L", "CB-L", "CB-R", "FB-R", "CM", "AM-L", "AM-R", "WAM-L", "WAM-R", "FWD"), 2)
)
position_bucket_list <- function(athleteData, positionName) {
bucket_list(
header = "",
group_name = "position.chart",
orientation = "horizontal",
add_rank_list(
text = positionName,
labels = as.list(athleteData %>% filter(athletePosition == positionName) %>% pull(athleteName)),
input_id = positionName
)
)
}
position_layout_4123 <- function(athleteData) {
fluidPage(
fluidRow(
column(width = 1),
column(width = 2, position_bucket_list(athleteData, 'WAM-L')),
column(width = 2),
column(width = 2, position_bucket_list(athleteData, 'FWD')),
column(width = 2),
column(width = 2, position_bucket_list(athleteData, 'WAM-R')),
column(width = 1)
),
fluidRow(
column(width = 3),
column(width = 2, position_bucket_list(athleteData, 'AM-L')),
column(width = 2),
column(width = 2, position_bucket_list(athleteData, 'AM-R')),
column(width = 3)
),
fluidRow(
column(width = 5),
column(width = 2, position_bucket_list(athleteData, 'CM')),
column(width = 5)
),
fluidRow(
column(width = 2, position_bucket_list(athleteData, 'FB-L')),
column(width = 1),
column(width = 2, position_bucket_list(athleteData, 'CB-L')),
column(width = 2),
column(width = 2, position_bucket_list(athleteData, 'CB-R')),
column(width = 1),
column(width = 2, position_bucket_list(athleteData, 'FB-R'))
),
fluidRow(
column(width = 5),
column(width = 2, position_bucket_list(athleteData, 'GK')),
column(width = 5)
)
)
}
#UI ----
ui <- fluidPage(
titlePanel("Soccer Positions"),
uiOutput(outputId = 'position.buck.list'),
)
#Server -----
server <- function(input, output, session) {
output$position.buck.list <- renderUI({position_layout_4123(athleteData)})
}
shinyApp(ui = ui, server = server)