Builds a boolean option.
Markup Examples:
data-foo="true"
data-foo="false"
The arguments to apply when building the option.
The resulting option value.
Builds a color option.
Normally, this simply builds a string that matches a CSS color.
Note:
In the markup, this offers no advantage over using a plain string. This is mostly useful for the Coveo JavaScript Interface Editor.
Markup Examples:
data-foo="coveo-sprites-user"
data-foo="coveo-sprites-database"
The arguments to apply when building the option.
The resulting option value.
Builds a field condition option.
A field condition option defines a field-based condition that must be dynamically evaluated against, and satisfied by a query result item in order to initialize a result template component.
Markup Example:
data-condition-field-author="Alice Smith, Bob Jones"
data-condition-field-not-filetype="pdf"`
The resulting option value.
Builds a field option.
A field option validates whether the field has a valid name. This means that the string must start with the @
character.
Markup Example:
data-foo="@bar"
The arguments to apply when building the option.
The resulting option value.
Builds an array of fields option.
As with all options that expect an array, you should use commas to delimit the different values.
Markup Example:
data-foo="@bar,@baz"
The arguments to apply when building the option.
The resulting option value.
Builds a helper option.
Normally, this simply builds a string that matches the name of a template helper.
Note:
In the markup, this offers no advantage over using a plain string. This is mostly useful for the Coveo JavaScript Interface Editor.
Markup Examples:
data-foo="date"
data-foo="dateTime"
The arguments to apply when building the option.
The resulting option value.
Builds an icon option.
This takes an SVG icon name, validates it and returns the name of the icon. Markup Examples:
data-foo="search"
data-foo="facet-expand"
The arguments to apply when building the option.
The resulting option value.
Tries to parse a stringified JSON option.
If unsuccessful (because of invalid syntax), the JSON option is ignored altogether, and the console displays a warning message.
Markup Example:
data-foo='{"bar" : "baz"}'
Note:
A JSON option can always be set as a property in the init
call of the framework rather than as a data-
property in the corresponding HTMLElement markup.
Initialization Example:
Coveo.init(root, {
Facet : {
foo : {
"bar" : "baz"
}
}
})
The arguments to apply when building the option.
The resulting option value.
Builds an array of strings option.
As with all options that expect an array, you should use commas to delimit the different values.
Markup Example:
data-foo="bar,baz"
The arguments to apply when building the option.
The resulting option value.
Builds a localized string option.
A localized string option can be any arbitrary string.
When parsing the value, the Coveo JavaScript Search Framework tries to load the localization for that string, if it is available.
If it is not available, it returns the non-localized value.
This should be used for options that will be rendered directly to the end users.
Markup Example:
data-foo="bar"
The arguments to apply when building the option.
The resulting option value.
Builds a number option.
A number option can be an integer or a float in the markup.
Note:
To build a float option, you need to set the
float
property in theIComponentOptionsNumberOptionArgs
totrue
.
Markup Examples:
data-foo="3"
data-foo="1.5"
The arguments to apply when building the option.
The resulting option value.
Builds a query expression option.
The query expression option should follow the Coveo Cloud Query Syntax Reference.
Markup Example:
data-foo="@bar==baz"
The arguments to apply when building the option.
The resulting option value.
Builds an option that allow to select an HTMLElement.
The option accepts a CSS selector matching the required HTMLElement. This selector can either be a class, or an ID selector.
Markup Examples:
data-foo-selector=".bar"
data-foo-selector="#bar"
The arguments to apply when building the option.
The resulting option value.
Builds a string option.
A string option can be any arbitrary string in the markup.
Markup Example:
data-foo="bar"
The arguments to apply when building the option.
The resulting option value.
Loads and parses the options of the current element.
Each component calls this method in its constructor.
The element whose markup options the method should load and parse.
The class of the component whose options the method should load and parse (e.g., Searchbox
,
Facet
, etc.)
The additional options which the method should merge with the specified markup option values.
The
ComponentOptions
static class contains methods allowing the Coveo JavaScript Search Framework to initialize component options.Typically, each
Component
that exposes a set of options contains a staticoptions
property.This property "builds" each option using the
ComponentOptions
method corresponding to its type (e.g.,buildBooleanOption
,buildFieldOption
,buildStringOption
, etc.)