Prompt¶
Prompt is a Dialog with a Cancel and a confirm button already set up. Use it for questions with a yes or no answer.
Usage¶
Call Components.Prompt with a scope and a table of properties:
C.Prompt(scope, {
Layer = overlayLayer,
Open = open,
Title = "Discard changes?",
ConfirmText = "Discard",
Destructive = true,
OnConfirm = discard,
OnClose = function()
open:set(false)
end,
})
Properties¶
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
Theme |
ThemeRef |
The contextual theme | Theme to use for this component instead of the one from Theme.Provide. |
|
LayoutOrder |
UsedAs<number> |
0 |
Position in a parent UIListLayout or UIGridLayout. |
|
Size |
UsedAs<UDim2> |
- | Size of the component. | |
Visible |
UsedAs<boolean> |
true |
Whether the component is shown. | |
ZIndex |
UsedAs<number> |
- | Z index of the component. | |
Layer |
Instance |
The layer from Layer.Provide or Layer.bind |
Overlay layer that floating content is mounted in. See Overlay layers. | |
Title |
UsedAs<string> |
- | Heading of the prompt. | |
Body |
UsedAs<string> |
- | Text under the heading. | |
Actions |
{ DialogAction } |
- | Buttons to use instead of the Cancel and confirm pair. | |
Open |
UsedAs<boolean> |
- | Whether the prompt is shown. Follows the state you pass. | |
Children |
any |
- | Custom content under the body. | |
Icon |
string |
- | Lucide icon above the title. | |
IconColor |
UsedAs<Color3> |
- | Colour of the icon. With Destructive, the icon is red unless this is set. |
|
IconSize |
number |
- | Size of the icon in pixels. | |
ConfirmText |
string |
"OK" |
Label of the confirm button. | |
CancelText |
string |
"Cancel" |
Label of the cancel button. | |
Destructive |
boolean |
false |
Make the confirm button red. |
Callbacks¶
| Name | Description |
|---|---|
OnClose: () -> () |
Runs when the user cancels or presses the scrim. |
OnConfirm: () -> () |
Runs when the user presses the confirm button. When left out, OnClose is called. |