Skip to content

How to center TabbedContent #5376

Closed Answered by TomJGooding
leonardig08 asked this question in Q&A
Discussion options

You must be logged in to vote

I think adding something like this in your CSS should work:

from textual.app import App, ComposeResult
from textual.widgets import Static, TabbedContent


class ExampleApp(App):
    CSS = """
    TabbedContent {
        & > ContentTabs {
            #tabs-list {
                align-horizontal: center;
            }
        }
    }
    """

    def compose(self) -> ComposeResult:
        with TabbedContent("Foo", "Bar", "Baz"):
            yield Static("Foo")
            yield Static("Bar")
            yield Static("Baz")


if __name__ == "__main__":
    app = ExampleApp()
    app.run()

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@leonardig08
Comment options

Answer selected by leonardig08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #5375 on December 11, 2024 10:12.