Skip to content

Add BorderTitle to Style#463

Closed
davidmdm wants to merge 1 commit intocharmbracelet:masterfrom
yokecd:master
Closed

Add BorderTitle to Style#463
davidmdm wants to merge 1 commit intocharmbracelet:masterfrom
yokecd:master

Conversation

@davidmdm
Copy link
Copy Markdown

@davidmdm davidmdm commented Jan 12, 2025

Related to #87

This adds a new Style API: BorderTitle(title string).

It is very limited in that it only sets a title on the top border and aligned to the left.
It only adds the title if the title fits otherwise it is ignored.

It could be more configurable but this should cover most needs.

For example:

lipgloss.NewStyle().
	Width(10).
	Height(4).
	Border(NormalBorder()).
	BorderTitle("Test").
	Render()

Would render:

┌─ Test ───┐
│          │
│          │
│          │
│          │
└──────────┘

@davidmdm davidmdm changed the title add possibility to add a border title Add BorderTitle to Style Jan 12, 2025
@davidmdm
Copy link
Copy Markdown
Author

@meowgorithm @aymanbagabas

Pinging for review ❤️

@davidmdm
Copy link
Copy Markdown
Author

Pushed commit to fix the linting issue and to rename the commit message to use conventional commit style.

@davidmdm
Copy link
Copy Markdown
Author

Also including a screenshot of what this looks like in a personal project of mine:
image

@davidmdm
Copy link
Copy Markdown
Author

@aymanbagabas @meowgorithm

Pr is ready for review!

Ps, what's the timeline or process for getting this merged? I am using my fork but it is awkward as other projects (such as bubbles) expect the charmbracelet/lipgloss types.

@bashbunni bashbunni added this to the border title milestone Jan 23, 2025
@bashbunni
Copy link
Copy Markdown
Contributor

Hi @davidmdm thanks for looking to make Lip Gloss better!

We have definitely gotten a lot of interest in having border titles in Lip Gloss. It's something we're interested in and we quite like what we've seen in #316 . It's a very thoughtful extension of the border API and allows for significant customization for the users which they will want down the line.

That said, we want to implement this carefully, so we don't want to rush a solution. As they say in software "Yes is forever". Thank you so much for your work here. I will be closing this PR as we are likely to move forward with some variation of nervo's implementation that offers more flexibility.

Thanks so much for your support 🙏 We truly appreciate it!

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 this pull request may close these issues.

2 participants