이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 7. Configuring a floating action button in Red Hat Developer Hub
You can use the floating action button plugin to configure any action as a floating button in the Developer Hub instance. The floating action button plugin is enabled by default. You can also configure floating action buttons to display as submenu options within the main floating action button by assigning the floating action buttons to the same slot
field of your dynamic-plugins.yaml
file.
7.1. Configuring a floating action button as a dynamic plugin
You can configure the floating action button as a dynamic plugin to perform actions or open an internal or external link.
Prerequisties
You must have sufficient permissions as a platform engineer.
Procedure
To configure a floating action button as a dynamic plugin, complete any of the following tasks:
Specify the
global.floatingactionbutton/config
mount point in yourapp-config-dynamic.yaml
file. For example:Example of a bulk-import plugin as a floating action button
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # Start of the floating action button configuration mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories # End of the floating action button configuration appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # Start of the floating action button configuration mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage
1 config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg>
2 label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories # End of the floating action button configuration appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import
Copy to Clipboard Copied! To configure an action as a floating action button that opens an external link, specify the
global.floatingactionbutton/config
mount point in yourdynamic-plugins.yaml
file within thebackstage-plugin-global-floating-action-button
plugin. For example:Example of a floating action button that opens GitHub
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-floating-action-button disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-global-floating-action-button: mountPoints: - mountPoint: application/listener importName: DynamicGlobalFloatingActionButton - mountPoint: global.floatingactionbutton/config importName: NullComponent config: icon: '<svg viewBox="0 0 250 300" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M200.134 0l55.555 117.514-55.555 117.518h-47.295l55.555-117.518L152.84 0h47.295zM110.08 99.836l20.056-38.092-2.29-8.868L102.847 0H55.552l48.647 102.898 5.881-3.062zm17.766 74.433l-17.333-39.034-6.314-3.101-48.647 102.898h47.295l25-52.88v-7.883z" fill="#40B4E5"/><path d="M152.842 235.032L97.287 117.514 152.842 0h47.295l-55.555 117.514 55.555 117.518h-47.295zm-97.287 0L0 117.514 55.555 0h47.296L47.295 117.514l55.556 117.518H55.555z" fill="#003764"/></svg>' label: 'Quay' showLabel: true toolTip: 'Quay' to: 'https://quay.io' - mountPoint: global.floatingactionbutton/config importName: NullComponent config: icon: github label: 'Git' toolTip: 'Github' to: https://github.com/redhat-developer/rhdh-plugins
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-floating-action-button disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-global-floating-action-button: mountPoints: - mountPoint: application/listener importName: DynamicGlobalFloatingActionButton - mountPoint: global.floatingactionbutton/config importName: NullComponent
1 config: icon: '<svg viewBox="0 0 250 300" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M200.134 0l55.555 117.514-55.555 117.518h-47.295l55.555-117.518L152.84 0h47.295zM110.08 99.836l20.056-38.092-2.29-8.868L102.847 0H55.552l48.647 102.898 5.881-3.062zm17.766 74.433l-17.333-39.034-6.314-3.101-48.647 102.898h47.295l25-52.88v-7.883z" fill="#40B4E5"/><path d="M152.842 235.032L97.287 117.514 152.842 0h47.295l-55.555 117.514 55.555 117.518h-47.295zm-97.287 0L0 117.514 55.555 0h47.296L47.295 117.514l55.556 117.518H55.555z" fill="#003764"/></svg>'
2 label: 'Quay' showLabel: true toolTip: 'Quay' to: 'https://quay.io' - mountPoint: global.floatingactionbutton/config importName: NullComponent config: icon: github label: 'Git' toolTip: 'Github' to: https://github.com/redhat-developer/rhdh-plugins
Copy to Clipboard Copied! To configure a floating action button that contains a submenu, define the
global.floatingactionbutton/config
mount point in the sameslot
field in yourdynamic-plugins.yaml
file for multiple actions. The default slot ispage-end
when not specified. For example:Example of a floating action button with submenu actions
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # Start of fab config mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories # end of fab config appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import - package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-floating-action-button disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-global-floating-action-button: mountPoints: - mountPoint: application/listener importName: DynamicGlobalFloatingActionButton - mountPoint: global.floatingactionbutton/config importName: NullComponent config: icon: github label: 'Git' toolTip: 'Github' to: https://github.com/redhat-developer/rhdh-plugins - mountPoint: global.floatingactionbutton/config importName: NullComponent config: icon: '<svg viewBox="0 0 250 300" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M200.134 0l55.555 117.514-55.555 117.518h-47.295l55.555-117.518L152.84 0h47.295zM110.08 99.836l20.056-38.092-2.29-8.868L102.847 0H55.552l48.647 102.898 5.881-3.062zm17.766 74.433l-17.333-39.034-6.314-3.101-48.647 102.898h47.295l25-52.88v-7.883z" fill="#40B4E5"/><path d="M152.842 235.032L97.287 117.514 152.842 0h47.295l-55.555 117.514 55.555 117.518h-47.295zm-97.287 0L0 117.514 55.555 0h47.296L47.295 117.514l55.556 117.518H55.555z" fill="#003764"/></svg>' label: 'Quay' showLabel: true toolTip: 'Quay' to: 'https://quay.io'
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # Start of fab config mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage
1 config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories # end of fab config appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import - package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-floating-action-button disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-global-floating-action-button: mountPoints: - mountPoint: application/listener importName: DynamicGlobalFloatingActionButton - mountPoint: global.floatingactionbutton/config importName: NullComponent
2 config: icon: github label: 'Git' toolTip: 'Github' to: https://github.com/redhat-developer/rhdh-plugins - mountPoint: global.floatingactionbutton/config importName: NullComponent
3 config: icon: '<svg viewBox="0 0 250 300" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M200.134 0l55.555 117.514-55.555 117.518h-47.295l55.555-117.518L152.84 0h47.295zM110.08 99.836l20.056-38.092-2.29-8.868L102.847 0H55.552l48.647 102.898 5.881-3.062zm17.766 74.433l-17.333-39.034-6.314-3.101-48.647 102.898h47.295l25-52.88v-7.883z" fill="#40B4E5"/><path d="M152.842 235.032L97.287 117.514 152.842 0h47.295l-55.555 117.514 55.555 117.518h-47.295zm-97.287 0L0 117.514 55.555 0h47.296L47.295 117.514l55.556 117.518H55.555z" fill="#003764"/></svg>' label: 'Quay' showLabel: true toolTip: 'Quay' to: 'https://quay.io'
Copy to Clipboard Copied! To configure a floating action button to display only on specific pages, configure the
global.floatingactionbutton/config
mount point in thebackstage-plugin-global-floating-action-button
plugin and set thevisibleOnPaths
property as shown in the following example:Example of a floating action button to display specific pages
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # start of fab config mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories visibleOnPaths: ['/catalog', '/settings'] # end of fab config appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # start of fab config mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage
1 config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories visibleOnPaths: ['/catalog', '/settings'] # end of fab config appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import
Copy to Clipboard Copied! - 1
- (Required) The import name with an associated component to the mount point.
To hide a floating action button on specific pages, configure the
global.floatingactionbutton/config
mount point in thebackstage-plugin-global-floating-action-button
plugin and set theexcludeOnPaths
property as shown in the following example:Example of a floating action button to hide specific pages
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # start of fab config mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories excludeOnPaths: ['/bulk-import'] # end of fab config appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import disabled: false pluginConfig: dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-bulk-import: # start of fab config mountPoints: - mountPoint: global.floatingactionbutton/config importName: BulkImportPage
1 config: slot: 'page-end' icon: <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg> label: 'Bulk import' toolTip: 'Register multiple repositories in bulk' to: /bulk-import/repositories excludeOnPaths: ['/bulk-import'] # end of fab config appIcons: - name: bulkImportIcon importName: BulkImportIcon dynamicRoutes: - path: /bulk-import/repositories importName: BulkImportPage menuItem: icon: bulkImportIcon text: Bulk import
Copy to Clipboard Copied! - 1
- (Required) The import name with an associated component to the mount point.
7.2. Floating action button parameters
Use the parameters as shown in the following table to configure your floating action button plugin.
Name | Description | Type | Default value | Required |
---|---|---|---|---|
|
Position of the floating action button. Valid values: |
|
| No |
| Name of the floating action button |
| Not applicable | Yes |
|
Icon of the floating action button. Recommended to use filled icons from the Material Design library. You can also use an svg icon. For example: |
| Not applicable | No |
| Display of the label next to your icon |
| Not applicable | No |
| Size of the floating action button |
|
| No |
| Color of the component. It supports both default and custom theme colors, that are added from the Palette Getting started guide. |
|
| No |
| Performed action when selecting a floating action button |
| Not applicable | No |
| Link that opens when selecting a floating action button |
| Not applicable | No |
| Text that appears when hovering over a floating action button |
| Not applicable | No |
| Order of the floating action buttons displayed in the submenu. A larger value means higher priority. |
| Not applicable | No |
| Display floating action button on the specified paths |
| Display floating action button on all paths | No |
| Hide floating action button on the specified paths |
| Display floating action button on all paths | No |
If multiple floating button actions are assigned to the same slot
value, the floating buttons are displayed as submenu options within the main floating action button.