-
Notifications
You must be signed in to change notification settings - Fork 260
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
Support block titles in top-right and bottom-right #1090
Comments
|
|
You know, it never occurred to me to use the alignment field for this. The functionality I want is already possible, and would continue to work with the other proposal. I'm going to close this. Thanks! |
The alignment field on title also does the same thing. The overlap in having a Title that contains a Line which both have alignment is where the removal proposal comes from. |
Problem
I have a use case for adding a title to the top-right of a block. The block already has a primary title in the top-left, but I'd like to add some secondary information to the top-right. The label could go in the bottom-left, but with the layout of my TUI, that makes it harder to notice. Top-right would make it the most discoverable.
Solution
block::Position
:TopLeft
,TopRight
,BottomRight
,BottomLeft
Top
andBottom
Block
to support the new variants, and treatTop
andBottom
the same asTopLeft
andBottomLeft
, respectivelyTop
andBottom
variantsAlternatives
You can manually write text on top of the block border, so this functionality is current possible, just inconvenient.
Additional context
#738 proposes to remove
Position
in favor of methods directly onBlock
:Block::top_title
andBlock::bottom_title
. This would conflict with my proposal. We could just add 4 methods toBlock
for titles, but that feels very inflexible and verbose. Instead, I propose updating the signature ofBlock::title
to the following:This would keep the flexibility of having positions be defined in an enum, while still eliminating the redundancy of the
Title
type.The text was updated successfully, but these errors were encountered: