# View Range-based Data ## Example Overview This example pairs a `TomSelectChoiceField` range selector with an HTMX-driven live preview: selecting a word-count range instantly redraws a bar chart of how many articles fall in each sub-bin (the selected range is broken into 10-word bins), all without a page reload. Use this pattern for interactive filtering and visualization - analytics dashboards, price or date-range filters, or any UI where users explore data distributions by selecting a range. **Visual Examples**   ## Key Code Segments ### Forms The form uses `TomSelectChoiceField` to allow users to select a range dynamically. :::{admonition} Form Definition :class: dropdown ```python class RangePreviewForm(forms.Form): """Form demonstrating dynamic range selection with live preview.""" word_count = TomSelectChoiceField( config=TomSelectConfig( url="autocomplete-page-count-range", value_field="value", label_field="label", css_framework="bootstrap5", placeholder="Select a word count range...", preload="focus", highlight=True, minimum_query_length=0, ), help_text="Select a word count range to see distribution visualization", ) ``` ::: **Explanation**: - The `word_count` field is configured with a `TomSelectConfig` object that connects to an autocomplete endpoint and allows range selection. - The `highlight` parameter ensures the selected range is visually prominent. ### Templates The form is rendered in the `range_preview.html` template, where HTMX is used to update the preview dynamically based on the selected range. :::{admonition} Template Code :class: dropdown ```html {% extends 'example/base_with_bootstrap5.html' %} {% block extra_header %} {{ form.media }} {% endblock %} {% block content %}