Styling constructs for adaptive forms
CREATED FOR:
- User
- Developer
Adobe recommends using the modern and extensible data capture Core Componentsfor creating new Adaptive Formsor adding Adaptive Forms to AEM Sites pages. These components represent a significant advancement in Adaptive Forms creation, ensuring impressive user experiences. This article describes older approach to author Adaptive Forms using foundation components.
Prerequisites
Knowledge of CSS and the LESS framework.
What can be customized
The article lists publicly available css classes of adaptive forms. You can use these classes to style various components of an adaptive form. The styling of authoring components, such as dialogs and status bars that display warnings are beyond the scope of this article. Use these styling constructs to create styles (using CSS or Less) only when you are unable to style components using theme editor.
Customizing styles in adaptive forms
The LESS framework simplifies the use case to customize styles in adaptive forms. The framework lets you define styles using a set of variables and functions (mixins). The LESS framework helps reduce the size of the bundled code and increases its reusability.
You can customize adaptive form styles in the following ways:
- Change the theme
- Change component’s style
Changing theme
You can change the theme of an adaptive form to ensure that its appearance is consistent with the web pages where the adaptive form is embedded.
Changes in the overall appearance of the adaptive form using CSS properties are typically part of theme changes. Major changes to the lo ``ok and feel of the adaptive form, such as changes in the layout and placement of components are not considered theme changes.
Based on the bootstrap, the following set of CSS properties define the theme of a web page:
- Background color
- Border (type, color, thickness)
- Font Color
- Padding
- Margin
- Font Size
- LineHeight
Currently, LESS variables are defined only for these properties of the various elements in an adaptive form.
Changing component style
You can change the appearance, layout, positioning, and visibility of elements. To achieve this task, create or update your custom .css files to include the styling constructs listed in this article.
To apply a style to an adaptive form, open the adaptive form in for editing, open properties of adaptive form conatiner, specify the path of custom CSS File in the basic tab. Defaut styling constructs of the adaptive form and overridden with the constructs listed in the custom .css file.
Components
The components discussed in this article have their predefined CSS classes. You can edit the variables to modify the styles in the CSS classes. Alternatively, you can rewrite the entire class. This section describes the classes within components and styles that you can modify using variables.
Container styling
A container is the top-level component. Other panels and fields lie under the container component.
guideContainerNode
container-bgColor
container-padding
container-margin
container-fontColor
Field styling
Adaptive forms include various types of fields. Each field has a unique class name, which is the name of the field. The field also has a common class name guideFieldNode
.
Fields include labels, widgets, Help description (both Long and Short description), and Field Help icons (question mark).
guideFieldNode
field-padding
field-error-font-color
field-error-font-size
Label styling
The HTML element label used for the field includes the classes left or top depending on whether the label is at the top or left.
guideFieldLabel
label-font-color
label-font-size
label-line-height
label-font-weight
label-margin
The CSS rules for the label are applied using the guideFieldLabel label. If you are an author, override this rule to make your custom changes visible.
Widgets styling
Depending on their type, widgets also include classes. Commonly, widgets include the guideFieldWidget
class. The widgets that ship with HTML normally use the standard HTML element input and select. The styling is done accordingly. You cannot style a custom widget by changing the variables.
guideFieldWidget
widgets-bg-color
widgets-border-color
widgets-border-thickness
widgets-border-radius
widgets-border-type
widget-border-focus-type
widgets-border
widgets-font-color
widgets-font-size
widgets-line-height
widgets-padding
widgets-focus-border-color
widgets-mandatory-border-color
widgets-mandatory-bg-color
widgets-disabled-bg-color
widgets-disabled-font-color
widgets-disabled-border-color
widget-height
checkbutton-height
listboxwidget-height
Limitations in widget styling
The styling for focused, mandatory, and disabled fields is restricted using variables. However, you can change it by overriding the styles. Restriction using variables is provided mainly to keep the number of variables in check. The restriction can be relaxed if the appearance of a field drastically changes because it is in any of the states discussed earlier.
Help description
An author can specify the Help content in the fields using Short and Long description components. Both components have a common class .guideHelpDescription
and another class .long
/ .short
, depending on the type of description. The Help content is enclosed in a paragraph element to override the styling of the description. The Help description (both long and short) is modified using variables starting with widgetshelp, as mentioned in following table:
widgets-help-long-bg-color
widgets-help-long-border-color
widgets-help-long-border-indicator-color
widgets-help-short-bg-color
widgets-help-short-color
widgets-help-short-tooltip-bg-color
widgets-help-short-tooltip-color
Terms and Conditions
The Terms and Conditions (TnC ``) widget lets you specify terms and conditions. You can customize the widget using the variables described in the following table.
tnc-unvisited
tnc-visited
Button
Buttons are also widgets. However, their styling is slightly different from the widgets. In adaptive forms, any of the following constitutes a button:
- input[type = text]
- button
- element with class .button
HTML code for button:
<button type="button" >
<span class="iconButtonicon"></
span>
<span class="iconButtonlabel"></
span>
</button>
iconButton-icon
iconButton-label
button-border-size
button-border-type
button-padding
button-font-size
button-background-color
button-font-color
button-border-color
button-large-padding
button-large-font-size
button-small-padding
button-small-font-size
button-info-background-color
button-info-font-color
button-info-border-color
button-warning-background-color
button-warning-font-color
button-warning-border-color
button-alert-background-color
button-alert-font-color
button-alert-border-color
Question mark
For the widgets, a questionMark is displayed when an author adds a long description in the Help content. The default icon provided in bootstrap is used. To use a custom icon, you can customize the bootstrap icons.
guideHelpQuestionMark
questionmark-font-color
questionmark-hover-font-color
Table
You can change the color theme for header and body rows in a table by using the following variables.
table-header-bg-color
#333
.table-odd-row-bg-color
rgb(255, 255, 255)
.table-even-row-bg-color
#eee
.File Attachment
The File Attachment widget of adaptive forms lets you upload files. You can also customize the widget using the variables.
fileItemPadding
fileItemBackground
fileItemBorderColor
fileItemColor
filePreviewIconColor
fileItemCommentHeight
Navigator Styles
There are four types of navigator tabs. These include tabs on the left, top, in the wizard and accordion. Each navigator has a different class.
Accordion
tabs on the left
tabs on the top
Wizard
The following is the HTML code for the tab navigator element is (similar to the bootstrap tabs):
<li>
<a>tab title</a>
</li>
Accordion navigator is an exception, it has following barebone
structure:
<div class="accordion.navigators">
<div>
<div class = "guideHeader">
<a>
<span class = "guideSummary" ></code>
........................... repeatable buttons, if the repeatable configuration is set ................................
<div class = "repeatableButtons">
<button name="Add" class="Add"/>
<button name="Remove" class="Remove"/>
</div>
</a>
</div>
................................ panel content ..................................
</div>
</div>
You can change the styling of the navigator using CSS rules that select the elements using descendant selectors. For example, to add a text decoration style to the anchor tag:
Tab navigator on top:
.tab-navigators
li a {
text-decoration:
underline;
}
Tab navigator on left:
.tab-navigators-vertical
li a {
text-decoration:
underline;
}
Accordion navigator:
.accordion-navigators .guideHeader a .guideSummary {
text-decoration:
underline;
}
Wizard navigator:
.wizard-navigators
li a {
text-decoration:
underline;
}
Additionally, there are classes to style tab navigators (both left and top) based on whether they have nested/child/sub navigators.
nested_true
nested_false
The guideNavIcon class provides a default icon to tab navigators (both left and top) and wizard navigators.
guideNavIcon
navigator-bg-color
tabs-bg-color
tabs-font-color
tabs-hover-bg-color
tabs-hover-font-color
tabs-active-bg-color
tabs-active-font-color
tabs-completed-bg-color
tabs-completed-font-color
tabs-stepped-bg-color
tabs-stepped-font-color
tabs-border-color
tabs-font-size
tabs-padding
tabs-margin
tabs-vertical-margin
tabs-border-thickness
tabs-min-height
heirarichal-indent
wizard-navigator-bg-color
wizard-tabs-bg-color
wizard-tabs-font-color
wizard-tabs-active-bg-color
wizard-tabs-active-font-color
wizard-tabs-completed-bg-color
wizard-tabs-completed-font-color
wizard-tabs-stepped-bg-color
wizard-tabs-stepped-font-color
wizard-tabs-border-color
wizard-tabs-font-size
wizard-tabs-padding
wizard-tabs-border-thickness
wizard-nav-bullet-border
wizard-progress-bg-color
wizard-progress-color
accordion-tabs-padding
Panel styling
A Panel includes an optional toolbar and its content.
guidePanelNode
panel-background-color
panel-font-size
panel-font-color
panel-padding
panel-description-font-size
panel-description-padding
panel-help-bg-color
panel-help-border-indicator-color
The panel node is divided into navigators and content. There ``is no separate styling component for the content. The variables described are applied on navigator and content.
The topmost panel (RootPanel) does not have this class.
Mobile styling
Header bar
These variables influence the header bar that is visible on a mobile device or small screen devices that contain panel title and next and back navigators.
guide-header-bar
headerbar-background-color
headerbar-font-color
headerbar-padding
Scroll indicator
These variables influence the Scroll indicator, which is an orange arrow that appears on a mobile device or small screen devices. A Scroll indicator indicates that there is content beyond the visible part of the screen. You can scroll down to see it. When you hit the end of content, the arrow disappears.
mobileScrollIndicator
scrollIndicatorBottom
scrollIndicatorRight
scrollIndicatorWidth
scrollIndicatorHeight
Mobile fixed toolbar layout-specific variables
These variables in the following table influence the mobile fixed toolbar layout.
mobileToolbar
mobileToolbarBottom
mobileToolbarTop
mobileToolbarLeft
mobileToolbarRight
mobileButtonIconTopMargin
mobileButtonIconWidth
mobileButtonIconHeight
mobilefixedtoolbarbgcolor
Theme-specific variable
The Simple enrollment theme at /etc/clientlibs/fd/af/guidetheme/simpleEnrollment and the category guide.theme.simpleEnrollment
also introduce a few variables. If you want to create a theme enhancing simple enrollment, you can use the following ``extra variables:
button-focus-bg-color
button-hover-bg-color
button-radius
navigation-button-bg-color
navigation-button-bg-hover-color
initial-nav-color
active-nav-color
visited-nav-color
tabs-bifercating-border-color
tabs-navigator-separator-color
tabs-child-nav-bg-color