Skip to content

Question : If resizable = TRUE and colDef(width) are used, resizable disabled. #223

Description

@daeyoonlee

Thanks for the great package.

Currently setting width in colDef seems to disable resizable. minwidth and maxwidth are also forced.
Is this intentional? I want to width only as an initial value and allow resizable. but there seems to be no way.
If only min width and maxwidth are used, resizable is possible, but the initial value is minwidth.

library(shiny)
library(reactable)

ui <- fluidPage(
  reactableOutput(outputId = "table"),
)

server <- function(input, output, session) {
  
  output$table <- renderReactable(
    reactable(
      data = iris,
      bordered = TRUE,
      resizable = TRUE,
      columns = list(
        Species = colDef(minWidth = 150, width = 200, maxWidth = 250)
      )
    )
  )
  
}

shinyApp(ui, server)

image

Activity

  1. glin commented on Feb 20, 2022

    @glin
    Owner

    Yes, this was intentional, or at least semi-intentional when resizing was reworked to respect the min and max widths of columns. Disabling resizing on fixed-width columns wasn't a primary intention, but came along with that rework. I can see how resizing would be useful on fixed-width columns though.

    Unfortunately, resizing can't be easily reenabled on fixed-width columns without undoing the work to limit resizing to min/max widths. It's somewhat complicated, so I'll tag this as a feature request to look into later for now.

  2. daeyoonlee commented on Feb 21, 2022

    @daeyoonlee
    Author

    thank you for the reply. If modifying the width option is complicated, it may be an alternative to add initWidth to the option.
    That is, if width is provided, initWidth is ignored(fixed width), if width is not provided and initWidth is provided, then initWidth is initialized. (in this case resizable should be possible)

  3. nteetor commented on May 25, 2026

    @nteetor
    Contributor

    I strongly second having an initial or default width option. In my use case, I am loading saved column widths and either,

    1. Users can no longer resize columns because I specify width
      or
    2. Users can no longer make columns smaller because I specify minWidth
  4. nteetor commented on May 25, 2026

    @nteetor
    Contributor

    I've opened drafted a PR to hopefully address this issue.

  5. added this to the v0.5.0 milestone on Jun 16, 2026
  6. glin commented on Jun 16, 2026

    @glin
    Owner

    Done in #425:

    • colDef() gains an initWidth argument to set a column's initial width in pixels while keeping the column resizable. Unlike width, which sets a fixed width and disables resizing, initWidth only sets the starting width, so the column can still be resized within its minWidth and maxWidth. (@nteetor, #223, #374)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions