Popconfirm
Properties
Property | Type | Description |
---|---|---|
title | string | Title of the popconfirm |
cancelText | string | Text displayed in the cancel option |
okText | string | Text displayed in the ok option |
description | string, string[] | Text displayed in popconfirm |
descriptionStyle | table | CSS Styling for the content of description |
disabled | boolean | Weather the popconfirm should display |
icon | string | Icon of the popover |
cancelButtonProps | table | See cancelButtonProps |
okButtonProps | table | See okButtonProps |
okType | string | Button type of ok option |
showCancel | string | Weather the cancel button should be displayed |
onCancel | function(event) | Fired when cancel is pressed |
onConfirm | function(event) | Fired when confirm/ok is pressed |
onPopupClick | function(event) | Fired when user clicks anywhere in popconfirm |
open | boolean | Controls weather the popconfirm is displayed |
All properties are optinoal. | ||
List of Icons can be found here | ||
See more properties here |
Children
Popconfirm can have children, by default when a child of popconfirm is clicked/focused it will open.
You can overwrite the open functionality if desired.Example
AM:createElement("Popconfirm", {
title = "Title",
description = "Are you sure you want to do this task?",
okText = "Yes",
cancelText = "No",
open = false,
onConfirm = function(_, _, event)
print("Clicked Confirm!")
--print("Event: ", json.encode(event))
end,
onCancel = function(_, _, event)
print("Clicked Cancel!")
--print("Event: ", json.encode(event))
end,
-- Fired when user clicks anywhere in the popup.
onPopupClick = function(_, _, event)
print("Clicked Popup!")
print("Event: ", json.encode(event))
end,
}, {
AM:createElement("Button", {text = "Do Task"}),
})
This is how it looks:

description
Can be either a string
or an array containing multiple strings.
description = {"1", "2", "3"}
would look like:

disabled
When disabled = true
the popover will not be displayed when children is clicked/focused.
icon
Change the icon in the pop-left corner of the popover.
icon = "QuestionCircleOutlined"
Looks like:

cancelButtonProps & okButtonProps
Properties of the 2 buttons.
Can be found here or on Ant Design So if you wanted to give icons to ok/confirm and cancel button, it would look like:cancelButtonProps = {icon = "ExclamationOutlined"},
okButtonProps = {icon = "CheckSquareOutlined"},
cancelButtonProps
Properties of the cancel button.
Can be found here (Button) Or on Ant Design So if you wanted to chance the type of cancel to "primary":cancelButtonProps = {type = "primary"}
okButtonProps
Properties of the ok/confirm button.
Can be found here (Button) Or on Ant Design So if you wanted to chance the type of ok/confirm to "link":okButtonProps = {type = "link"}
okType
The type of button the ok/confirm button is.
okType = "link",
showCancel
Weather the cancel button should be displayed.
So ifshowCancel = false
, cancel button will be hidden.

onCancel
Event is fired when user clicks the cancel button.
onCancel = function(_, _, event)
print("Clicked Cancel!")
print("Event: ", json.encode(event))
end
onConfirm
Event is fired when user clicks the confirm/ok button.
onConfirm = function(_, _, event)
print("Clicked Confirm!")
print("Event: ", json.encode(event))
end
onPopupClick
Event is fired when user clicks anywhere in the popup/popconfirm.
onPopupClick = function(_, _, event)
print("Clicked in Popup!")
print("Event: ", json.encode(event))
end
open
Controls weather the popconfirm is open or closed, so you can overwrite how the popconfirm will be displayed.
Example
local popconfirm; popconfirm = AM:createElement("Popconfirm", {
title = "Title",
description = "Are you sure you want to do this task?",
okText = "Yes",
cancelText = "No",
open = false,
}, {
AM:createElement("Button", {text = "Do Task"}),
})
local controller; controller = AM:createElement("Button", {
text = "Open Popconfirm!",
onClick = function (id, name, event)
local newState = not popconfirm.open
popconfirm.open = newState
if newState then
controller.text = "Close Popconfirm!"
else
controller.text = "Open Popconfirm!"
end
end,
})
In this example the button within popconfirm does not open it, but the controller button does instead.
