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

feat: new ya.confirm() API #2095

Merged
merged 1 commit into from
Dec 24, 2024
Merged

feat: new ya.confirm() API #2095

merged 1 commit into from
Dec 24, 2024

Conversation

sxyazi
Copy link
Owner

@sxyazi sxyazi commented Dec 24, 2024

An implementation of the feature request: #2082

Closes #2082


local answer = ya.confirm {
  pos = { "center", w = 40, h = 10 },
  title = "Test",
  content = "Hello, World!",
}

You can also apply a UI element to the title and content, to customize the appearance:

local answer = ya.confirm {
  pos = { "center", w = 40, h = 10 },
  title = ui.Line("Test"):fg("yellow"):bold(),
  content = ui.Text("Hello, World!"):bg("red"):fg("#ffffff"),
}

The available values for pos are the same as those for ya.input(), https://yazi-rs.github.io/docs/plugins/utils#ya.input

@sxyazi sxyazi merged commit 7d3e589 into main Dec 24, 2024
6 checks passed
@sxyazi sxyazi deleted the pr-857832b6 branch December 24, 2024 16:35
@hankertrix
Copy link
Contributor

hankertrix commented Dec 25, 2024

Would you be open to renaming pos to position? It's to match the ya.input arguments.

@sxyazi
Copy link
Owner Author

sxyazi commented Dec 25, 2024

ya.input's position will be deprecated and renamed to pos in the future, to match its type name ui.Pos

@hankertrix
Copy link
Contributor

Ah I see, thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose the confirm component to plugin developers
2 participants