Skip to content

Commit

Permalink
allow specifying a different icon for checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
Squibid committed Dec 30, 2024
1 parent 3f9abc9 commit 14fd287
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit 14fd287

Please sign in to comment.