The Range Slider component provides a draggable interface that allows the user to select a range between 0-100. This component is currently only used within the Range Slider Facet Component.

Tag

The tag for this component is <hawksearch-range-slider>.

Event-Binding Attributes

Name Value
hawksearch-handle 'start' or 'end'

This component should always have exactly two elements with the hawksearch-handle attribute: one with a value of 'start', and one with a value of 'end'. This are the elements that the user will drag to adjust the selected range.

Events

Name Data Type
hawksearch:range-slider-changed RangeSliderEventData

This event fires repeatedly while the user is dragging the handles; it does not wait until the user deselects a handle.

Note: The min and max values will always be between 0 and 100 inclusive.

Default Template

The following is the default Handlebars template for this component. To create a custom template, it is recommended to use this as a starting point.

<div class="range-slider">
<div class="range-slider__container">
<div class="range-slider__bar">
<div class="range-slider__bar__active" hawksearch-bar style="left: {{start}}%; right: {{subtract 100 end}}%;"></div>
</div>
<span class="range-slider__handle range-slider__handle--start" title="{{strings.start}}" hawksearch-handle="start" style="left: {{start}}%;"></span>
<span class="range-slider__handle range-slider__handle--end" title="{{strings.end}}" hawksearch-handle="end" style="left: {{end}}%;"></span>
</div>
</div>

Hierarchy

Properties

bindFromEvent: boolean = false
componentName: keyof HawkSearchComponents = 'range-slider'

Optional instance-level configuration to override the global configuration

The data bound to the Handlebars template.

data?: undefined

The data bound to the component.

defaultHtml: string = defaultHtml
handlebars: typeof Handlebars = HawkSearch.handlebars

The Handlebars reference shared by all HawkSearch components.

Accessors

  • get configuration(): undefined | TConfig
  • The optional configuration object for this component.

    Returns undefined | TConfig

  • get rootElement(): ParentNode
  • The root element which should be used for querying any child elements. This resolves to this.shadowRoot if the Shadow DOM is enabled, otherwise this.

    Returns ParentNode

  • get observedAttributes(): string[]
  • Returns string[]

Methods

  • Parameters

    • name: string
    • oldValue: null | string
    • newValue: null | string

    Returns void

  • After the component is rendered, this method is called to bind any child components.

    Returns void

  • Returns void

  • Returns void

  • Replaces placeholders in a given string with values from a data object.

    Parameters

    • template: string

      The template string.

    • values: Record<string, string>

      The object containing properties which will be bound to template.

    Returns string

    The template string with all placeholders replaced by the values specified in values.

  • After the component is rendered, this method is called for any additional processing (such as attaching event listeners) which needs to occur.

    Returns void

  • Optional method that can be overwritten to register Handlebars helper functions which can be accessed from the template. For more information, see Custom Helpers.

    Returns void

  • Determines whether the data meets the necessary conditions to perform data binding and render content.

    Returns boolean

    Whether the component should be rendered. If false, the component will have empty contents and be set to display: none;.

  • Type Parameters

    • T

    Parameters

    • name: string
    • data: T

    Returns void