Skip to content

rx.segmented_control.root() with more than 10x .item() #5651

@jumbi77

Description

@jumbi77

Describe the bug

If we exceed 10x .item() in the rx.segmented_control.root() the selected item is not highlighted anymore. In the attached screenshot, in both segmented_controls the last item is selected, but only in the first segment with <=10 items, it is visible.

To Reproduce

class SegmentedState(rx.State):
    options: list[str] = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
    control: str = "1"
    options2: list[str] = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"]
    control2: str = "1"

...
rx.segmented_control.root(
    rx.foreach(
        SegmentedState.options,
        lambda label: rx.segmented_control.item(label, value=label.lower()),
    ),
    on_change=SegmentedState.setvar("control"),
    value=SegmentedState.control,
),

rx.segmented_control.root(
    rx.foreach(
        SegmentedState.options2,
        lambda label: rx.segmented_control.item(label, value=label.lower()),
    ),
    on_change=SegmentedState.setvar("control2"),
    value=SegmentedState.control2,
),
....

Screenshots

Image

Specifics (please complete the following information):

  • Python Version:3.13
  • Reflex Version: 0.8.3
  • OS: macOS
  • Browser (Optional): Safari

Metadata

Metadata

Assignees

Labels

components buga bug in a specific component

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions