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

allow specifying a different icon for checkboxes #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lua/volt/ui/components.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ local M = {}
--- @class CheckboxOptions
--- @field active boolean Indicates if the checkbox is active.
--- @field txt string The text to display next to the checkbox.
--- @field check string|nil Replace the default check icon with a custom one.
--- @field uncheck string|nil Replace the deafult unchecked icon with a custom one.
--- @field hlon? string|nil Highlight for the active state (optional).
--- @field hloff? string|nil Highlight for the inactive state (optional).
--- @field actions table|nil Actions associated with the checkbox (optional).
Expand All @@ -11,7 +13,7 @@ local M = {}
--- @return string[] A table containing the checkbox representation.
M.checkbox = function(o)
return {
(o.active and " " or " ") .. o.txt,
(o.active and (o.check or "") or (o.uncheck or "")).. " " .. o.txt,
o.active and (o.hlon or "String") or (o.hloff or "ExInactive"),
o.actions,
}
Expand Down