Skip to main content

Styling

The Kapa Support Form Deflector allows for extensive customization of its appearance through data- attributes in the script tag. These attributes support global theme configurations as well as specific styling parameters for individual components.

Global Theme Configuration

The following attributes set global styles that apply across all components.

ParameterDescriptionDefault Value
data-project-colorDefines the primary color for the deflector, applied to elements such as the loader and link colors. You should set this to your brand's color"#FFFF00"
data-font-familySets the font family for all text elements."-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji"
data-font-size-xsDefines font size for extra-small text elements."0.75rem"
data-font-size-smDefines font size for small text elements."0.875rem"
data-font-size-mdDefines font size for medium text elements."1rem"
data-font-size-lgDefines font size for large text elements."1.125rem"
data-font-size-xlDefines font size for extra-large text elements."1.25rem"

Component Style Configuration

The support form deflector supports flexible styling for its components using data- attributes. Each component has a unique attribute name (e.g., answer-box), and you can apply a range of CSS properties to customize its appearance. The component style configurations override any global theme configurations.

Supported Parameters

The following parameters map to standard CSS properties and can be applied to all components. The default values for these parameters depend on the specific component. All of these parameters are optional.

ParameterDescription
padding-xDefines horizontal padding
padding-yDefines vertical padding
background-colorDefines background color
colorDefines text color
font-sizeDefines font size
font-weightDefines font weight
borderDefines border style
border-radiusDefines border radius
opacityDefines opacity
margin-topDefines top margin
margin-bottomDefines bottom margin
margin-rightDefines right margin
margin-leftDefines left margin

Available Components

The following components of the support form deflector can be customized with the Supported Parameters. Some components support additional individual configuration options. Some components inherit configured parameters from each other.

NameAttribute NameDescriptionInheritance
Answer Boxanswer-boxThe element that renders Kapa's response.-
Answer Box Headeranswer-box-headerThe header section of the Answer Box.-
Answer Box Header Titleanswer-box-header-titleThe title rendered inside the Answer Box Header.-
Answer Box Footeranswer-box-footerThe footer section of the Answer Box.-
Answer Box Footer Textanswer-box-footer-textText elements inside the Answer Box Footer.-
Loading Indicatorloading-indicatorThe loading indicator displayed inside the Answer Box while the response is being generated.-
Info Textinfo-textText elements rendered outside the Answer Box, providing additional information about the answer generation.-
Pre-Submit Infopre-submit-infoAn informational text displayed before answer generation is triggered.Info Text
Post-Submit Infopost-submit-infoAn informational text displayed after answer generation is completed.Info Text
Loading Infoloading-infoAn informational text displayed while the response is being generated.Info Text

Applying Styles to Components

To style a component, concatenate the data- prefix with the component's attribute name (e.g., answer-box) and the CSS property name. This forms the complete data- attribute for the component. For example:

Example: Styling the Answer Box Component

To customize the Answer Box component, use the following attributes in the script tag:

<script
...
data-answer-box-padding-x="10px"
data-answer-box-padding-y="2rem"
data-answer-box-background-color="#ADD8E6"
data-answer-box-color="inherit"
data-answer-box-font-size="12px"
data-answer-box-font-weight="500"
data-answer-box-border="1px solid #00008B"
data-answer-box-border-radius="25px"
></script>