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

Add a collapsible container widget #2918

Closed
rodrigogiraoserrao opened this issue Jul 11, 2023 · 3 comments · Fixed by #2989
Closed

Add a collapsible container widget #2918

rodrigogiraoserrao opened this issue Jul 11, 2023 · 3 comments · Fixed by #2989
Assignees
Labels
enhancement New feature or request

Comments

@rodrigogiraoserrao
Copy link
Contributor

rodrigogiraoserrao commented Jul 11, 2023

(This issue is reserved for the EuroPython 2023 sprint. If you are not participating in the sprint, please refrain from working on this issue. Thanks!)

This issue concerns itself with adding a new container widget to Textual.
This new container widget should be a collapsible container that can be toggled to show or hide its contents.

The diagram below exemplifies this behaviour:

Untitled-2023-07-11-2122

For users building apps, this collapsible widget should be usable in a way that is similar to the TabbedContent widget; something along the lines of

class MyApp(App):
    def compose(self):
        with CollapsibleContainer("Some title or label here"):
            yield Label("My label")
            yield Input()
            with Horizontal():
                yield Button("Button 1")
                yield Button("Button 2")
                yield Button("Button 3")

The collapsible container should have a reactive attribute that represents the label for the collapsible section.

This container widget is likely going to end up as a compound widget.
There should be another reactive attribute to control the toggled state of the container.

Take a look at #2333 to see what files need to be changed when you implement a new widget.
Then, don't be like me and also do the final step shown in #2399 to add your new widget to the widget gallery.

Good luck and have fun!

(As a follow-up, see issue #2919.)

@rodrigogiraoserrao rodrigogiraoserrao added the enhancement New feature or request label Jul 11, 2023
@willmcgugan
Copy link
Collaborator

Bonus points to optionally animate the expand / collapse.

@YooSunYoung
Copy link
Contributor

I would like to work on this issue!

@github-actions
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants