ElementsContent & layout
CreateFAQ
Creates an accordion-style list of questions and answers.
CreateFAQ
What it does
Creates an accordion-style list of questions and answers.
When to use it
Use it for help content where only one or a few answers should be expanded at a time.
ElementFunction:CreateFAQ(FAQConfig)
local FAQ = RightGroup:CreateFAQ({
Name = "Frequently Asked Questions",
Exclusive = true,
Items = {
{
Question = "Why was this fanmade Gen 2 created?",
Answer = "So people can experience a Gen 2 style Rayfield right now instead of waiting for the official release. It is a fan project built from zero, not a replacement for the real thing."
},
{
Question = "Will my existing Rayfield scripts work?",
Answer = "Yes. The compatibility API keeps familiar window, tab, and element methods while using the Verbal Hub layout and themes."
},
{
Question = "Can more than one answer stay open?",
Answer = "Set Exclusive to false or AllowMultiple to true. By default, opening one answer closes the others."
},
{
Question = "Can questions be changed later?",
Answer = "Yes. Use FAQ.Items[index]:Set(), FAQ:AddItem(), FAQ:Open(), FAQ:Close(), FAQ:Toggle(), or FAQ:SetItems()."
},
{
Question = "Does it work on mobile?",
Answer = "Yes. The full question card uses Activated input, wraps long text, recalculates its height, and animates on touch and mouse."
}
},
Callback = function(index, opened, item)
print("FAQ", index, opened, item.Question)
end
})Behavior and return value
Store the returned controller or object when later code needs to update its state, call its methods, or close it.
Fields marked optional may be omitted. XLQP then uses the method’s built-in default or leaves that feature disabled.