Skip to content

How to Make SelectCurrent Fill the Entire Width of a Select Element When Using border_title? #5633

Closed Answered by ddkasa
Walterhart asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Walterhart ,

Since the background of SelectCurrent is different to the main Select widget you will have to set it to $surface.

from textual.app import App, ComposeResult
from textual.widgets import Select


class SelectApp(App[None]):
    CSS = """
    Select {
        background: $surface;
        border: wide white;

        & > * {
            border: none;
            padding: 1 0;
        }
    }
    """

    def compose(self) -> ComposeResult:
        yield (select := Select([("Foo", "bar")]))
        select.border_title = "Rank"


if __name__ == "__main__":
    SelectApp().run()

Or you could target SelectCurrent directly and adjust it.

from textual.app import App, ComposeResult
f…

Replies: 1 comment 1 reply

Comment options

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

Answer selected by Walterhart
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