Skip to content

Question : Is text-overflow: ellipsis available for Static widget? #1183

Answered by davep
crftwr asked this question in Q&A
Discussion options

You must be logged in to vote

There isn't currently a method of doing this via Textual's CSS, although believe it's something we'd like to do. Meanwhile though, if I'm understanding your requirement correctly, I think you should be able to do what you're after with a combination of Static from Textual and Text from Rich, like this:

from textual.app import App, ComposeResult
from textual.containers import Container
from textual.widgets import Static
from rich.text import Text

class Box( Container ):

    DEFAULT_CSS = "Box { border: solid red; height: auto; background: #555; }"

    def compose(self) -> ComposeResult:
        yield Static(
            Text( "Happiness, free, for everyone, and let no one be forgotten!", 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@crftwr
Comment options

@davep
Comment options

Answer selected by crftwr
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 #1174 on November 15, 2022 13:52.