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 Copy linkLink copied to clipboard!
You can configure the floating action button as a dynamic plugin to perform actions or open an internal or external link.
Prerequisites
- 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/configmount point in yourapp-config-dynamic.yamlfile. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow frontend:mountPoints:importName- (Required) The import name with an associated component to the mount point.
frontend:mountPoints:importName:icon-
Use the
svgvalue to display a blackBulkImportPageicon.
To configure an action as a floating action button that opens an external link, specify the
global.floatingactionbutton/configmount point in yourdynamic-plugins.yamlfile within thebackstage-plugin-global-floating-action-buttonplugin. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow frontend:mountPoints:importName- Enter the import name with an associated component to the mount point.
frontend:mountPoints:importName:icon-
(Optional) Enter the icon in Scalable Vector Graphics (SVG) format to display the
Quayicon.
To configure a floating action button that contains a submenu, define the
global.floatingactionbutton/configmount point in the sameslotfield in yourdynamic-plugins.yamlfile for multiple actions. The default slot ispage-endwhen not specified. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow frontend:mountPoints:importName- (Required) The import name with an associated component to the mount point.
To configure a floating action button to display only on specific pages, configure the
global.floatingactionbutton/configmount point in thebackstage-plugin-global-floating-action-buttonplugin and set thevisibleOnPathsproperty as shown in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow frontend:mountPoints:importName- Enter the import name with an associated component to the mount point.
To hide a floating action button on specific pages, configure the
global.floatingactionbutton/configmount point in thebackstage-plugin-global-floating-action-buttonplugin and set theexcludeOnPathsproperty as shown in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow frontend:mountPoints:importName- Enter the import name with an associated component to the mount point.
7.2. Translation support Copy linkLink copied to clipboard!
The Global Floating Action Button plugin supports internationalization (i18n) through translation keys. You can use labelKey and toolTipKey properties to provide translation keys instead of static text.
Example for using translation keys in dynamic configuration:
7.3. Enabling floating action button localization in RHDH Copy linkLink copied to clipboard!
You can enable translation key support for floating action buttons, so that users can onboard in their preferred language. In Developer Hub, all existing and newly created floating action buttons support localization using dedicated translation keys.
The Global Floating Action Button plugin supports internationalization (i18n) through translation keys. You can use labelKey and toolTipKey properties to provide translation keys instead of static text.
The plugin provides the following built-in translation keys organized under the fab namespace:
-
fab.create.label- "Create" -
fab.create.tooltip- "Create entity" -
fab.docs.label- "Docs" -
fab.docs.tooltip- "Documentation" -
fab.apis.label- "APIs" -
fab.apis.tooltip- "API Documentation" -
fab.github.label- "GitHub" -
fab.github.tooltip- "GitHub Repository" -
fab.bulkImport.label- "Bulk Import" -
fab.bulkImport.tooltip- "Register multiple repositories in bulk" -
fab.quay.label- "Quay" -
fab.quay.tooltip- "Quay Container Registry"
The plugin includes translations for the following supported languages:
- English (default)
- French (fr)
To ensure backward compatibility while providing translation support when available, the following order is used to resolve string translations:
-
If the
labelKeyis provided, the plugin will attempt to resolve the translation key - If the translation key is found, it will be used as the label
- If the translation key is not found, the plugin will fall back to the label property
The same logic applies to toolTipKey and toolTip.
7.3.1. Internal translation implementation Copy linkLink copied to clipboard!
The plugin uses a centralized translation system where:
-
The
useTranslation()hook is called in components that render floating action buttons to ensure proper translation context initialization -
The translation function (
t) is passed down to child components that need to resolve translation keys - This internal architecture prevents infinite re-render loops and ensures stable component rendering
-
All components that use
CustomFabmust provide the translation function as a prop
When extending or modifying the plugin components, ensure that the useTranslation() hook is called in parent components and the t prop is passed to CustomFab instances to maintain proper translation functionality and prevent rendering issues.
7.4. Floating action button parameters Copy linkLink copied to clipboard!
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 |
|
| Translation key for the label. If provided, will be used instead of label when translations are available. |
| Not applicable | No |
|
|
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 |
|
| Translation key for the tooltip. If provided, will be used instead of toolTip when translations are available. |
| 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.