Home > Blockchain >  Change search bar text in reactable table in R
Change search bar text in reactable table in R

Time:10-28

How do you change the search bar text "Search" in a reactable table? I would like to change "Search" to "Search for Your Name"

I have looked everywhere online for a solution but haven't found anything. The reactable examples article doesn't have anything either. Also, their section on custom filtering has examples that don't work anymore.

data <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "AirBags", "Price")]
reactable(data, searchable = TRUE, minRows = 10)

CodePudding user response:

I believe you have to use reactableLang to change the search placeholder. Here you can understand a little better about these features.

CodePudding user response:

The solution is below using reactableLang:

data <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "AirBags", "Price")]

reactable(
  data,
  searchable = TRUE,
  paginationType = "simple",
  language = reactableLang(
    searchPlaceholder = "Search for Your Name",
    noData = "No entries found",
    pageInfo = "{rowStart}\u2013{rowEnd} of {rows} entries",
    pagePrevious = "\u276e",
    pageNext = "\u276f",
    
    # Accessible labels for assistive technology, such as screen readers
    pagePreviousLabel = "Previous page",
    pageNextLabel = "Next page"
  )
)
  • Related