HTML
The HTML component allows you to insert custom HTML content into your survey. This is useful for adding rich text, images, videos, or any other HTML elements that are not covered by the standard question types.
Basic Usage
Parameters
Unique identifier for the HTML component.
The HTML content to be inserted into the survey. Must be a non-empty string.
Custom styles to apply to the HTML container. All style keys from the base Element class are available for styling.
Data
Response Format
The HTML component does not collect any data, so it doesn’t have a response format.
Validation
The HTML component always passes validation as it doesn’t collect any data.
Advanced
Methods
The HTML component inherits methods from the base Element class, but most are not applicable as it doesn’t collect data. Here are some key methods:
Always returns an object indicating valid status as HTML components don’t require validation.
Returns:
- An object with
isValid
(boolean) set to true and an emptyerrorMessage
string.
Generates the HTML structure for the component.
Returns:
string
: The generated HTML
Renders the HTML content or updates it if already rendered.
Parameters:
surveyElementStyles
(object): Styles to be applied from the survey level
Removes the HTML content from the DOM.
Example
Here’s an example of how to create a more complex HTML component: