Skip to content

Panel

A card with a title and description at the top, your content in the middle and an optional row of buttons at the bottom. Use it for menus, shop items and settings groups.

Panel examplePanel example
Lucy.Panel.new({
    title = "Moonwalk",
    description = "Glide backwards across the Dance Floor",
    size = UDim2.fromOffset(360, 0),
    children = { Lucy.Text.new({ text = "300 coins", variant = "large" }) },
    footer = {
        Lucy.Button.new({
            text = "Buy",
            icon = "lucide-extended:shopping-bag-filled",
            onClick = function() app.toast("Moonwalk unlocked") end,
        }),
        Lucy.Button.new({ text = "Try it on", variant = "outline" }),
    },
    Parent = parent,
})

Props

PropTypeDefaultState keyWhat it does
titlestring""yesThe heading
descriptionstring""yesText under the heading
visiblebooleantrueyesShows or hides the panel
childrentableInstances or handles to put in the content area
footertableInstances or handles to put in the footer, such as buttons
sizeUDim2fills the width, height fits the contentThe panel’s size
maxWidthnumberThe widest it gets, in pixels
minWidthnumberThe narrowest it gets, in pixels
aspectRationumberKeeps a fixed shape, such as 16 / 9

It also takes the props every component takes.

Parts

NameWhat it is
panel.headerThe frame with the title and description
panel.contentThe frame that holds children; add more to it any time
panel.footerThe frame that holds footer (hidden when there is none)

Examples

A fixed width panel with a form:

Panel examplePanel example
local panel = Lucy.Panel.new({
    title = "Settings",
    size = UDim2.fromOffset(360, 0),
    children = {
        Lucy.Switch.new({ label = "Music", checked = true }),
        Lucy.Switch.new({ label = "Club lights", checked = true }),
    },
    footer = { Lucy.Button.new({ text = "Done", onClick = closeSettings }) },
    Parent = frame,
})

Add content later:

Lucy.Text.new({ text = "Crowd volume saved", variant = "muted", Parent = panel.content })

Preview

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