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

feat: accordion #1075

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Conversation

ethanalvizo
Copy link
Contributor

@ethanalvizo ethanalvizo commented Jan 6, 2025

Updated the event example with the changes we discussed for the onExpandedChange prop. Getting an infinite re-render now when something is toggled. Tried passing in both handled_expanded_keys_change and set_expanded_keys directly into the on_expanded_change prop

from deephaven import ui

@ui.component
def ui_accordion_event():
    expanded_keys, set_expanded_keys = ui.use_state(["a"])

    def handle_expanded_keys_change(e):
        print("Expanded key changed", e)
        set_expanded_keys(list(e))

    return ui.accordion(
        ui.disclosure(title="FAQ #1", panel="Answer", id="a"),
        ui.disclosure(title="FAQ #2", panel="Answer", id="b"),
        expanded_keys=expanded_keys,
        on_expanded_change=set_expanded_keys
    )

my_accordion_event = ui_accordion_event()

image

@ethanalvizo ethanalvizo requested a review from mofojed January 6, 2025 08:12
@ethanalvizo ethanalvizo self-assigned this Jan 6, 2025
} from '@deephaven/components';

export function Accordion(props: DHCAccordionProps): JSX.Element {
const { children, ...otherProps } = props;
Copy link
Member

Choose a reason for hiding this comment

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

Summarizing the issue we discussed on call that you're observing with expandedKeys...

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.

2 participants