RinteRface / shinyMobile

shiny API for Framework7 (IOS/android)
https://shinymobile.rinterface.com
405 stars 74 forks source link

Possible to use f7Segment() + f7Button() as a segmented control? #214

Open rbcavanaugh opened 2 years ago

rbcavanaugh commented 2 years ago

Hi thanks for putting together this package.

I was wondering if it was possible (or perhaps intended) to use the f7Segment() function as a segmented control (https://developer.apple.com/design/human-interface-guidelines/ios/controls/segmented-controls/). From one of the examples in the documentation:

f7Segment(
          container = "segment",
          f7Button(color = "blue", label = "My button", rounded = TRUE),
          f7Button(color = "green", label = "My button", rounded = TRUE),
          f7Button(color = "yellow", label = "My button", rounded = TRUE)
        )

This creates what appears to be a segmented control. However, selecting the button doesn't permanently change the color/fill of that button with respect to the others. The desired behavior would be something akin to shinyWidgets::radioGroupButtons().

thanks again!

Editing to add: I was able to achieve this but rendering the f7Segment() on the server side within a renderUI() and changing the active = T/F argument for each button based on a reactiveValue that changed based on the most recent button press, but this feels a little clunky

DivadNojnarg commented 1 year ago

Hi, I can confirm, f7Segment is a just a simple container at the moment. I keep this in the backlog maybe for a future release.