Survey-Level Styling
Survey-level styles are applied globally to all elements within a survey. These styles serve as default styles for all elements and can be overridden by element-level styles.Element-Level Styling
Element-level styles are applied to individual elements and take precedence over survey-level styles. This allows for fine-grained control over the appearance of specific elements.Basic Usage
Survey-Level Styling
Apply styles to all elements in a survey by passing astyles object during survey initialization:
Element-Level Styling
For individual elements, pass astyles object in the element’s constructor:
Style Keys
Each element type has its own set of style keys that can be customized. Here are the common style keys:- SingleSelect and MultiSelect:
optionsContainer,option,radio/checkbox - NumberEntry:
input,unit - OpenEnd:
textarea - Grid:
table,headerRow,headerCell,row,rowLabel,cell
Applying Styles
Styles are applied as CSS-in-JS objects. You can use any valid CSS property, using camelCase for property names:Inheritance and Overriding
- Default Styles: Each element type has built-in default styles.
- Survey-Level Styles: These override the default styles for all elements in the survey.
- Element-Level Styles: These have the highest priority and override both default and survey-level styles for the specific element.
Custom Elements and Styling
When creating custom elements by extending the Element class, you can define your own style keys and implement custom styling. Here’s an example:styleKeys, you specify which style properties can be customized for your custom element.
