Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IconButton for color_mode with nice default and a position props to control it #3165

Merged
merged 7 commits into from
Apr 26, 2024

Conversation

Lendemor
Copy link
Collaborator

class PositionState(rx.State):
    position: str = ""

@rx.page(route="/")
def color_icon_button():
    return rx.vstack(
        rx.select(
            ["top-left", "top-right", "bottom-left", "bottom-right"],
            value=PositionState.position,
            on_change=PositionState.set_position,
        ),
        rx.color_mode.icon_button(position=PositionState.position)
        rx.color_mode.icon_button(position="top-right"),
        rx.color_mode.icon_button(position="top-left"),
        rx.color_mode.icon_button(position="bottom-left"),
        rx.color_mode.icon_button(position="bottom-right", bottom="10rem", right="10rem")
    )

Copy link
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry meant to make my comments on the .py not the .pyi, but oh well.

It would also be cool if the ColorModeIcon could take props and apply them to the icon, although i see that's not really how the code is currently written.

reflex/components/radix/themes/color_mode.pyi Outdated Show resolved Hide resolved
reflex/components/radix/themes/color_mode.pyi Outdated Show resolved Hide resolved
@picklelo picklelo merged commit 92cdc15 into main Apr 26, 2024
46 checks passed
@picklelo picklelo deleted the lendemor/add_high_level_color_mode_icon_button branch August 21, 2024 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants