Skip to content

Single cell height Select widget? #5652

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

Closed
leemthai opened this issue Mar 15, 2025 · 4 comments
Closed

Single cell height Select widget? #5652

leemthai opened this issue Mar 15, 2025 · 4 comments

Comments

@leemthai
Copy link

Is it possible to do single cell height Select widgets? The fix with Input to get them to be one cell high is to add border=None to the CSS but it doesn't seem to work for Select (There always appears to be an empty line at the top)?

I see the excellent posting app has 1-height Select widget, and everything, basically :-)

Copy link

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@davep
Copy link
Contributor

davep commented Mar 15, 2025

Select is one of those widgets where you can't really style it "just so" without diving into the source a little and seeing how the widget is constructed. By the sounds of things it's the SelectCurrent you want to be styling. For example:

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

class ShortSelectApp(App[None]):

    CSS = """
    SelectCurrent {
        border: none;
    }
    """

    def compose(self) -> ComposeResult:
        yield Select[int]((("First", 0), ("Second", 1), ("Third", 2)))
        yield Select[int]((("First", 0), ("Second", 1), ("Third", 2)))
        yield Select[int]((("First", 0), ("Second", 1), ("Third", 2)))

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

Is that the kind of effect you were looking for?

@leemthai
Copy link
Author

Yeah, that's exactly the effect I was looking for. Cheers.

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
None yet
Projects
None yet
Development

No branches or pull requests

3 participants