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

Add BorderTitle to Style #463

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

davidmdm
Copy link

@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
Author

@meowgorithm @aymanbagabas

Pinging for review ❤️

@davidmdm
Copy link
Author

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

@davidmdm
Copy link
Author

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

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.

1 participant