Pre-v1.5 Controls
Before v1.5, Flipbook used a simpler controls format where arrays were treated as implicit selection lists. This format is still supported at runtime (Flipbook automatically migrates it when loading your stories), but upgrading to the current syntax is recommended for clarity and type-safety.
What Changed
In the old format, you could pass an array directly as a control value. Flipbook would interpret it as a list of options with the first item selected by default:
local controls = {
size = { "Small", "Medium", "Large" },
}
local story = {
controls = controls,
story = function(_props)
return Instance.new("TextLabel")
end,
}
return story
The equivalent in the current format uses an explicit constructor:
local Storyteller = require("@pkg/Storyteller")
local controls = {
size = Storyteller.createSelectControl({ "Small", "Medium", "Large" }, {
default = "Small",
}),
}
local story = {
controls = controls,
story = function(_props)
return Instance.new("TextLabel")
end,
}
return story
Primitive values (string, number, boolean) work the same in both formats and do not need to be changed.
Upgrading
Here's a story using the old format alongside its equivalent using the current constructors:
local story = {
controls = {
label = "Hello",
count = 5,
isVisible = true,
size = { "Small", "Medium", "Large" },
alignment = { "Left", "Center", "Right" },
},
story = function(_props)
return Instance.new("TextLabel")
end,
}
return story
local Storyteller = require("@pkg/Storyteller")
local controls: Storyteller.StoryControlsSchema = {
label = Storyteller.createStringControl("Hello"),
count = Storyteller.createNumberControl(5),
isVisible = Storyteller.createBooleanControl(true),
size = Storyteller.createSelectControl({ "Small", "Medium", "Large" }, {
default = "Small",
}),
alignment = Storyteller.createSelectControl({ "Left", "Center", "Right" }, {
default = "Left",
}),
}
local story: Storyteller.Story<unknown> = {
controls = controls,
story = function(_props)
return Instance.new("TextLabel")
end,
}
return story
The explicit constructor functions unlock additional options that aren't available in the old format, such as custom sort functions, display label overrides via tostring, and the full range of new control types like Color, Date, Slider, Radio, MultiSelect, and Check.
No Action Required
If you're not ready to upgrade, your existing stories will continue to work without any changes. Flipbook performs the migration automatically at load time, so there's no breaking change.