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

Default button size is not accurate #3793

Closed
MuongKimhong opened this issue Dec 2, 2023 · 2 comments
Closed

Default button size is not accurate #3793

MuongKimhong opened this issue Dec 2, 2023 · 2 comments

Comments

@MuongKimhong
Copy link
Contributor

MuongKimhong commented Dec 2, 2023

In the documentation (https://textual.textualize.io/widgets/button/#additional-notes), it says The default styling for a Button has the height set to 3 lines and a min-width of 16 columns.

but if I don't specify the height in css it will give me height of 1 instead.

example, without specifying height in css

class MyApp(App):
    def compose(self) -> ComposeResult:
        yield Button("Hello")

    def on_button_pressed(self, event: Button.Pressed) -> None:
        log(event.button.size)  # this will display Size(widget=16, height=1)

specifying height in css

# css
Button {
    height: 3;
    border: none;
}

class MyApp(App):
    CSS_PATH = ...

    def compose(self) -> ComposeResult:
        yield Button("Hello")

    def on_button_pressed(self, event: Button.Pressed) -> None:
        log(event.button.size)  # this will display Size(widget=16, height=3)

Noted that in Button class, the default css has border set to none.

Copy link

github-actions bot commented Dec 2, 2023

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

Copy link

github-actions bot commented Dec 3, 2023

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

Successfully merging a pull request may close this issue.

1 participant