Action-Button
π Developer Guide
With the Action-Button Brick, you can easily add Buttons to your dashboards.
You are able to listen to the Actions, which will be emitted on Button click to react with Scripting onto them.
π Example
Designer
Runtime
βοΈ Configuration Properties
Config
| Key | Label | Description | Default Value |
|---|---|---|---|
| | | |
id |
ID of the Button | Can be selected using CSS via #flyze-button-id string UUID |
Random UUID |
version |
Decider for the version of the Button | Please always use modern, since legacy will be removed in the future!modern-inline allows you to inject content into button directly in the template (Not viable in scripting!) It just exists for backward compability purposesM modern legacy modern-inline |
legacy |
text |
The text inside the Button | Accepts strings (string) |
- |
tooltip |
Displays a tooltip on hover | Accepts a string, which will be set inside the tooltip wrapper (string) |
- |
state |
The state of the button | Allows to switch between pre defined states. can also specify a string to define your own default | inverted | transparent | disabled | hover | |
default |
size |
The size of the button | Allows to switch between pre defined sizes. Use custom to define your own size. xsmall | small | default | medium | large | custom |
default |
| | | |
| | |
Shortcut (config.shortcut)
| Key | Label | Description | Default Value |
|---|---|---|---|
key |
The key to be pressed | Accepts keys as strings e.g. a Once this is set, the shortcut will be available |
string |
ctrlKey |
Enables the Ctrl-Modifier | Accepts either true or false (boolean) |
- |
altKey |
Enables the Alt-Modifier | Accepts either true or false (boolean) |
- |
shiftKey |
Enables the Shift-Modifier | Accepts either true or false (boolean) |
- |
Prefix-Icon (config.prefixIcon)
Suffix-Icon (config.suffixIcon)
π¨ CSS Variables
The (These
variables
will
evenVariable
allowNameyouDescription
tooverride
predefined
states
without the use of !important)
:root {
/* State specific */
-β-fyz-sb-buton-action-button-bg/* translates to the background-color of the button */
-βfyz-sb-button-color /* translates to the textBackground color of the button
*//*
Size specific */
-β-fyz-sb-action-button-colorText color of the button
--fyz-sb-action-button-font-size/*Font
translates to the font-size of the button */text
-β-fyz-sb-action-button-auto-font-size@see
-auto- variables
--fyz-sb-button-height/* translates to the heightHeight of the button
*/β
--fyz-sb-button-paddingauto-height/*@see
translates-auto- tovariablesthepadding
--fyz-sb-button-padding-tbPadding of the button (
Top,top Right,and Bottom,bottom)Left)*/
β--fyz-sb-button-radiusauto-padding-tb/*@see
translates-auto- tovariablestheborder-radius
--fyz-sb-button-padding-lrPadding of the button
*/(left }and right)
--fyz-sb-button-auto-padding-lr@see
-auto- variables
--fyz-sb-button-radiusBorder-Radius of the button
--fyz-sb-button-auto-radius@see
-auto- variables
--fyz-sb-button-gapGap between icon and text inside the button
--fyz-sb-button-auto-gap@see
-auto- variables
-auto- variables are used to automatically adjust the respective property based on device view or respective parent components. They should not be set directly by the user. For each -auto- variable, there is a corresponding non--auto- variable that can be set by the user to override the automatic behavior.
π οΈ Usage
Designer
(Use the build in configuration Inputs in the right Side-Nav)
Config
(Edit the whole configuration of the Button to your liking)
β¨οΈ Programmatical Data
How to style custom States/Styles
This example shows, how to style your Button via CSS
(For this example we set customStateName to insane and customSizeName to round-massive)
[state="insane"] {
--fyz-sb-button-bg: red;
--fyz-sb-button-color: yellow;
}
[state="insane"]:hover {
--fyz-sb-button-bg: blue;
}
[size="round-massive"] {
--fyz-sb-button-font-size: 32px;
--fyz-sb-button-height: 78px;
--fyz-sb-button-padding: 12px 8px 12px 8px;
--fyz-sb-button-radius: 50%;
}
Use the Layout Brick to style buttons based on that example
How to update the Button via Scripting
// βοΈ Retrieve the current configuration of the Brick
const config = fyzBrick.cRef.getConfig();
// π± Modify and merge the config to change to the desired button/behavior
fyzBrick.cRef.mergeConfig({
...config,
text: 'Hello, i am updated!',
shortcut: {
key: 'a',
ctrlKey: true,
shiftKey: true,
altKey: false
},
state: 'custom',
customStateName: 'updated-button'
})
Example of a fully fletched Button config
{
"version": "modern",
"text": "Hit me up",
"tooltip": "I dare you",
"visible": true,
"show": true,
"eventBus": "brick",
"state": "default",
"shortcut": {
"key": "a",
"ctrlKey": true,
"altKey": true,
"shiftKey": false
},
"prefixIcon": {
"version": "modern",
"iconCategory": "social",
"iconName": "eco",
"size": "small"
},
"suffixIcon": {
"version": "modern",
"iconCategory": "action",
"iconName": "play",
"size": "default"
}
}







