ButtonGrid
A grid of <Button>
components.
Integrates the Button Grid control from Tweakpane-creator Hiroki Kokubun's Essentials plugin.
See <RadioGrid>
for a radio-flavored variation.
Svelte Tweakpane UI also includes some additional logic to manage default grid dimensions:
If no
rows
orcolumns
props are provided, it will create a grid with the squarest possible aspect ratio for the given quantity ofvalues
.If a single
rows
orcolumns
prop is provided, it lets the undefined axis grow / shrink as needed to accommodate the quantity ofvalues
.If both
rows
andcolumns
props area provided, then buttons may be clipped ifrows * columns < values.length
.
Usage outside of a <Pane>
component will implicitly wrap the button grid in <Pane position="inline">
.
Note that Svelte Tweakpane UI embeds a functionally identical fork of the plugin with build optimizations. The fork also changes the package name from @tweakpane/plugin-essentials
to @kitschpatrol/tweakpane-plugin-essentials
for consistency with other plugins.
required | |
Description | Array of names, each of which will become the title of a button in the grid. |
---|---|
Type | string[] |
optional | |
Description | Number of columns to arrange the buttons into. Setting |
---|---|
Type | number |
Default | undefined Dynamic based on quantity of buttons . |
optional | |
Description | Text displayed next to the button grid. |
---|---|
Type | string |
Default | undefined |
optional | |
Description | Number of rows to arrange the buttons into. Setting |
---|---|
Type | number |
Default | undefined Dynamic based on quantity of buttons . |
optional | |
Description | Prevent interactivity and gray out the control. |
---|---|
Type | boolean |
Default | false |
optional | |
Description | Custom color scheme. |
---|---|
Type | Theme |
Default | undefined Inherits default Tweakpane theme equivalent to ThemeUtils.presets.standard , or the theme set with setGlobalDefaultTheme() . |
Description | Fires when a button is clicked. Note that the values described in the |
---|---|
Type | ButtonGridClickEvent |