|
| 1 | +:_mod-docs-content-type: PROCEDURE |
| 2 | +[id="proc-configuring-floating-action-button-as-a-dynamic-plugin_{context}"] |
| 3 | += Configuring a floating action button as a dynamic plugin |
| 4 | + |
| 5 | +You can configure a dynamic plugin as a floating action button to perform actions or open an internal or external link. |
| 6 | + |
| 7 | +.Procedure |
| 8 | + |
| 9 | +. Add the `app-config-dynamic.yaml` content into `app.config-local.yaml`. |
| 10 | + |
| 11 | +. Set the disabled property to `false`. For example: |
| 12 | ++ |
| 13 | +[source,yaml] |
| 14 | +---- |
| 15 | +global: |
| 16 | + dynamic: |
| 17 | + includes: |
| 18 | + - dynamic-plugins.default.yaml |
| 19 | + plugins: |
| 20 | + - package: ./dynamic-plugins/dist/backstage-plugin-global-floating-action-button |
| 21 | + disabled: false |
| 22 | +---- |
| 23 | + |
| 24 | +. To configure a dynamic plugin as a floating action button, complete any of the following tasks: |
| 25 | + |
| 26 | +** Specify the `global.floatingactionbutton/config` mount point in your plugin configuration. For example: |
| 27 | ++ |
| 28 | +.bulk-import plugin as a floating action button example |
| 29 | +[source,yaml] |
| 30 | +---- |
| 31 | + dynamicPlugins: |
| 32 | + frontend: |
| 33 | + red-hat-developer-hub.backstage-plugin-bulk-import: |
| 34 | + # Start of the floating action button configuration |
| 35 | + mountPoints: |
| 36 | + - mountPoint: global.floatingactionbutton/config |
| 37 | + importName: BulkImportPage <1> |
| 38 | + config: |
| 39 | + slot: 'page-end' |
| 40 | + icon: bulkImportIcon |
| 41 | + label: 'Bulk import' |
| 42 | + toolTip: 'Register multiple repositories in bulk' |
| 43 | + to: /bulk-import/repositories |
| 44 | + # End of the floating action button configuration |
| 45 | + appIcons: |
| 46 | + - name: bulkImportIcon |
| 47 | + importName: BulkImportIcon |
| 48 | + dynamicRoutes: |
| 49 | + - path: /bulk-import/repositories |
| 50 | + importName: BulkImportPage |
| 51 | + menuItem: |
| 52 | + icon: bulkImportIcon |
| 53 | + text: Bulk import |
| 54 | +---- |
| 55 | +<1> (Required) The import name with an associated component to the mount point. |
| 56 | +
|
| 57 | +** To configure a dynamic plugin as a floating action button that opens an external link, specify the `global.floatingactionbutton/config` mount point in the `backstage-plugin-global-floating-action-button` plugin. For example: |
| 58 | ++ |
| 59 | +.floating action button that opens Github example |
| 60 | +[source,yaml] |
| 61 | +---- |
| 62 | + dynamicPlugins: |
| 63 | + frontend: |
| 64 | + red-hat-developer-hub.backstage-plugin-global-floating-action-button: |
| 65 | + mountPoints: |
| 66 | + - mountPoint: application/listener |
| 67 | + importName: DynamicGlobalFloatingActionButton |
| 68 | + - mountPoint: global.floatingactionbutton/config |
| 69 | + importName: NullComponent |
| 70 | + config: |
| 71 | + icon: github |
| 72 | + label: 'Git' |
| 73 | + toolTip: 'Github' |
| 74 | + to: https://github.com/redhat-developer/rhdh-plugins |
| 75 | +---- |
| 76 | +
|
| 77 | +.Floating action button parameters |
| 78 | +|=== |
| 79 | +| Name | Description | Type | Default value | Required |
| 80 | +
|
| 81 | +| `slot` |
| 82 | +| Position of the floating action button. Valid values: `PAGE_END`, `BOTTOM_LEFT` |
| 83 | +| `enum` |
| 84 | +| `PAGE_END` |
| 85 | +| No |
| 86 | +
|
| 87 | +| `label` |
| 88 | +| Name of the floating action button |
| 89 | +| `String` |
| 90 | +| Not applicable |
| 91 | +| Yes |
| 92 | +
|
| 93 | +| `icon` |
| 94 | +| Icon of the floating action button. Recommended to use filled icons from the link:https://fonts.google.com/icons[Material Design library]. |
| 95 | +| `StringReact.ReactElement` |
| 96 | +| Not applicable |
| 97 | +| No |
| 98 | +
|
| 99 | +| `showLabel` |
| 100 | +| Display of the abel next to your icon |
| 101 | +| `Boolean` |
| 102 | +| Not applicable |
| 103 | +| No |
| 104 | +
|
| 105 | +| `size` |
| 106 | +| Size of the floating action button |
| 107 | +| `small`, `medium`, `large` |
| 108 | +| `medium` |
| 109 | +| No |
| 110 | +
|
| 111 | +| `color` |
| 112 | +| Color of the component. It supports both default and custom theme colors, that are added from the link:https://mui.com/material-ui/customization/palette/#custom-colors[Palette Getting started guide]. |
| 113 | +| `default`, `error`, `info`, `inherit`, `primary`, `secondary`, `success`, `warning` |
| 114 | +| `default` |
| 115 | +| No |
| 116 | +
|
| 117 | +| `onClick` |
| 118 | +| Performed action when selecting a floating action button |
| 119 | +| `React.MouseEventHandler` |
| 120 | +| Not applicable |
| 121 | +| No |
| 122 | +
|
| 123 | +| `to` |
| 124 | +| Link that opens when selecting a floating action button |
| 125 | +| `String` |
| 126 | +| Not applicable |
| 127 | +| No |
| 128 | +
|
| 129 | +| `toolTip` |
| 130 | +| Text that appears when hovering over a floating action button |
| 131 | +| `String` |
| 132 | +| Not applicable |
| 133 | +| No |
| 134 | +
|
| 135 | +| `priority` |
| 136 | +| Order of the floating action buttons displayed in the submenu. |
| 137 | +//For example, to display a particular floating action button first, use `priority: 1` -- waiting to confirm this with Debsmita and Shiran |
| 138 | +| `number` |
| 139 | +| Not applicable |
| 140 | +| No |
| 141 | +
|
| 142 | +| `visibleOnPaths` |
| 143 | +| Display floating action button on the specified paths |
| 144 | +| `string[]` |
| 145 | +| Display floating action button on all paths |
| 146 | +| No |
| 147 | +
|
| 148 | +| `excludeOnPaths` |
| 149 | +| Hide floating action button on the specified paths |
| 150 | +| `string[]` |
| 151 | +| Display floating action button on all paths |
| 152 | +| No |
| 153 | +
|
| 154 | +|=== |
| 155 | +
|
| 156 | +[NOTE] |
| 157 | +==== |
| 158 | +If multiple floating button actions are assigned to the same `Slot`, these floating buttons are displayed as submenu options within the main floating action button. |
| 159 | +==== |
0 commit comments