deephaven / deephaven-plugins

Deephaven Plugins
7 stars 14 forks source link

`ui.radio` does not have `value` prop default to label #765

Open AkshatJawne opened 3 weeks ago

AkshatJawne commented 3 weeks ago

Description

Steps to reproduce

  1. Run snippet below:
from deephaven import ui

def handle_on_change(value):
    print(f"Value has been changed to: {value}")

my_radio_group_basic_without_value = ui.radio_group(
    ui.radio("Dogs"),
    ui.radio("Cats"),
    ui.radio("Lizard"),
    ui.radio("Fish"),
    label="What is the best type of pet",
    on_change=handle_on_change
)

my_radio_group_basic_with_value = ui.radio_group(
    ui.radio("Dogs", value="dogs"),
    ui.radio("Cats", value="cats"),
    ui.radio("Lizard", value="lizard"),
    ui.radio("Fish", value="fish"),
    label="What is the best type of pet",
    on_change=handle_on_change
)
  1. Switch between radio buttons in both radio groups

Expected results

Should log labels in radio group where the radio buttons do not have a value provided.

Actual results

None is logged once, and then nothing is logged.

Additional details and attachments

Should have it such that the value default to the label, if the label is text. Otherwise, if the label is an icon + text for example, we make it so that value has to be passed in.

Versions

Engine Version: 0.37.0-SNAPSHOT Web UI Version: 0.90.0 Java Version: 21.0.4 Barrage Version: 0.6.0 Browser Name: Chrome 127 OS Name: macOS 10.15.7 @deephaven/js-plugin-plotly-express: 0.11.2 @deephaven/js-plugin-ui: 0.19.0 @deephaven/js-plugin-matplotlib: 0.5.0

AkshatJawne commented 3 weeks ago

The following updates to the radio_group docs need to be made following the completion of this ticket: a. Base example should show options without value b. Document how value is set to the label if the label is text, and if the label is not text, the value prop has to be set