Axis options
This page describes the axis option for the variantProperties
API. In basic
set-up, the same choice is the property’s ‘Layout
in Figma canvas’ setting.
Options axis="x" and axis="y"
Default configuration
By default, story.to.design will lay out variants vertically, like this:
And the default configuration will be:
{
"initArgs": {},
"variantProperties": [
"disabled",
"kind",
"variant"
]
}
However, if you are not happy with the default layout of a variant,
it can be adjusted in basic set-up by editing the property (it needs at least
two values) and changing ‘Layout in Figma canvas’, or in Advanced setup with the axis option.
Using axis="x"
{
"initArgs": {},
"variantProperties": [
"disabled",
"kind",
{
"fromArg": "variant",
"axis": "x"
}
]
}
Result
Using axis="y"
{
"initArgs": {},
"variantProperties": [
"disabled",
"kind",
{
"fromArg": "variant",
"axis": "y"
}
]
}
Result
Option axis="split"
With the axis="split" option, you can create groups of individual components.
This is particularly helpful if you want to split icons into multiple components to use them in instance swaps.
Icons as variants default
Using axis="split"
{
"initArgs": {
"color": "neutral-500"
},
"variantProperties": [
{
"fromArg": "name",
"axis": "split"
}
]
}