Configuring style properties
Use the style configuration element to configure the look and feel of the Advanced Identity Cloud/PingAM Login Widget. Style properties are set as part of the initial widget configuration, before the widget starts. Pass them to configure() and await it before starting any journey.
See Step 4. Configure the widget for more on the configuration step.
style property to control aspects of the displayKey:
-
Use
style/logoto add images for use in dark or light modes -
Set
style/stage/icontotrueto render UI specific to certain stage parameter values. Supported stage values are:-
OneTimePassword- enable the Advanced Identity Cloud/PingAM Login Widget to display one-time password entry forms correctly. -
DefaultRegistration- adds UI elements to the display most suitable for user self-registration forms. -
DefaultLogin- adds UI elements to the display most suitable for user log in forms.
-
-
A section that displays the Page Header and Page Description fields from the page node configuration
-
To float labels above their respective fields, set
style/labelstofloating -
Use
style/showPasswordto control how the password visibility toggle is rendered
import { configure } from '@forgerock/login-widget';
await configure({
serverConfig: {
wellknown: 'https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/realms/root/realms/alpha/.well-known/openid-configuration',
},
style: {
checksAndRadios: 'animated',
labels: 'floating',
showPassword: 'button',
logo: {
dark: 'https://example.com/img/white-logo.png',
light: 'https://example.com/img/black-logo.png',
height: 300,
width: 400,
},
sections: {
header: false,
},
stage: {
icon: true,
},
},
});
|
The |
Learn more about the available properties in Style configuration options in the API reference.
Adding a header section
Enabling the header section separates the logo or branding from the journey form.
If you set header: true within the style/sections property, the modal uses a section with a separating line, and extra space:
By default, the separating section is not enabled:
Configuring theme colors and fonts
Use the properties in the style/theme configuration element to set brand colors, typography, border radii, and per-component styles.
|
For structural changes beyond what these properties expose, such as spacing and breakpoints, see Customizing default themes at build time. |
Each style/theme configuration property maps to a scoped CSS custom property on the widget’s root element.
import { configure } from '@forgerock/login-widget';
await configure({
serverConfig: {
wellknown: 'https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/realms/root/realms/alpha/.well-known/openid-configuration',
},
style: {
theme: {
primaryColor: '#f46200',
secondaryColor: '#003049',
backgroundColor: '#ffffff',
linkColor: '#f46200',
fontFamily: 'Inter, sans-serif',
buttonBorderRadius: 8,
cardBorderRadius: 12,
},
},
});
The theme properties available are as follows:
| Property | Description |
|---|---|
|
Hex color values (6 or 8 digit, for example |
|
Hex color value for the widget’s secondary brand color. |
|
Hex color for the page or modal background. |
|
Hex colors for card background and text. |
|
Hex color for general body text within the widget. |
|
Hex colors for links in their default and active states. |
|
Hex colors for form input background, border, label, and text. |
|
Hex color for the focus ring on form inputs. |
|
Hex colors for |
|
Hex color for button text. |
|
Hex color for the focus ring on buttons. |
|
A CSS font family string, for example |
|
Full URL or base64 data URI to override the logo image. Applies a single logo regardless of color scheme. For separate light and dark variants, use |
|
Number of pixels for the logo height. |
|
Full URL for the browser tab icon. |
|
Numbers, in pixels, controlling the corner rounding of buttons and cards. |
|
|
See also
-
Customizing default themes at build time: structural style changes requiring a Tailwind rebuild
-
Style configuration options: full
styleconfiguration reference