pesde goatsoft / lucy

Inline Confirm

Asks the player to confirm without covering the screen. Its content steps aside for "Are you sure?" with YES and NO; NO puts the content back. Use it where a Dialog would hide the very thing being asked about: skipping a Tour (it asks this way), clearing a routine, leaving a queue.

Inline Confirm exampleInline Confirm example
local confirm
confirm = Lucy.InlineConfirm.new({
    children = {
        Lucy.Text.new({ text = "Your routine has 12 moves." }),
        Lucy.Button.new({ text = "CLEAR", variant = "outline", onClick = function()
            confirm:ask()
        end }),
    },
    yesVariant = "destructive",
    onYes = function() clearRoutine() end,
    Parent = panel,
})

Props

PropTypeDefaultState keyWhat it does
questionstring"Are you sure?"yesWhat it asks
yesstring"YES"yesThe YES button's text
nostring"NO"yesThe NO button's text
yesVariantstring"default"yesThe YES Button's variant (destructive for a loss)
noVariantstring"outline"yesThe NO button's variant. Make NO the solid one (default) to steer players to it
askingbooleanfalseyesWhether it is asking now
visiblebooleantrueyesShows or hides it
childrentableThe content shown while it is not asking
onYesfunction(confirm): the player said YES
onNofunction(confirm): the player said NO, or pressed back

It also takes the props every component takes.

Methods

MethodWhat it does
confirm:ask()Swaps the content for the question
confirm:answer(yes)Answers as the player would
confirm:cancel()Puts the content back without an answer
confirm.asking()Whether it is asking (tracked)

Input

While it asks, back (B, Backspace) answers NO. With a gamepad or keyboard, asking moves focus to NO, the safe answer, and NO gives focus back to what had it (usually the button that asked).

Look

The question is semibold in Foreground (inside a Tour callout, PopoverForeground), with small YES and NO buttons beside it (YES default, NO outline unless you swap them). It fills the width of its parent and grows to fit. Parts: confirm.content, confirm.prompt, confirm.question, confirm.yes and confirm.no. Tags: ui-inline-confirm, ui-inline-confirm-asking, ui-inline-confirm-question.

Preview

In Studio, from the command bar: Lucy.Preview.show("InlineConfirm").