Range

Range input patterns including live values, stepped sliders, and dual-handle filtering UI.

Overview

The Range component is a core building block of the Byteion design system, providing a robust, accessibility-compliant interface for its specific UI capabilities.

Why this exists

Range sliders let users select a numeric value within a known bounds through direct manipulation. They are more intuitive than typing a number when the exact value is not critical.

Mental model

A range slider maps a continuous or stepped numeric value to a draggable thumb on a track. Use when approximate selection is acceptable.

When to use

• Volume, brightness, or zoom controls • Price range filters • Quantity selectors with a known max • Opacity or blur controls in design tools

When not to use

• Do not use when exact numeric input is required — use a number input • Avoid for values outside a clear min/max range • Do not use for categorical selection

Basic example

The following example demonstrates standard usage, fully compliant with Byteion's token-first approach.

Variants

Each variant communicates a different meaning. Choose based on priority, not aesthetics.

Single default variant.

Sizes

Size should match the importance and context of the component.

  • md — md size.

States

This component reacts seamlessly to the following interaction and data states:

  • idle — idle state.
  • disabled — Non-interactive — grayed out, cursor not-allowed.
  • default — Resting appearance before interaction.
  • hover — Pointer is over the element — visual feedback via color or shadow.
  • focus — Keyboard or tab focus — shows ring indicator for accessibility.
  • active — Currently selected or in use.

Anatomy

• Track — the line representing the range • Thumb — draggable handle • Fill — colored portion of track • Value display — shows current value

Usage guidelines

  • Always show the current numeric value.
  • Set sensible min, max, and step.
  • Use for approximate, not exact, selection.

Do and Don't

Do

  • Show the current value numerically.
  • Set appropriate step increments.
  • Use for filters and approximate controls.

Don't

  • Do not use when precision matters — use a number input.
  • Do not hide the value.
  • Do not use for non-numeric selection.

Accessibility

Uses <input type="range"> with aria-valuemin, aria-valuemax, aria-valuenow. Arrow keys adjust by step.

Role:slider

Customization

Track and thumb colors are customizable via CSS variables.

Compose with React cva()

Use the exportedcva() +cn() utilities to compose your own variant on top of the Byteion tokens.

import { cva, cn, type VariantProps } from '@byteion/react';

const myRange = cva('base classes…', {
 variants: {
  accent: { soft:'border-primary-200', loud:'border-primary-500' },
 },
 defaultVariants: { accent:'soft' },
});

type Props = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof myRange>;

Compose with Vue cva()

Use the exportedcva() +cn() utilities inside standard Vue setup blocks.

<script setup lang="ts">
import { computed, useAttrs } from 'vue';
import { cva, type VariantProps } from '@byteion/vue';

interface Props { accent?:'soft' |'loud' }
const props = withDefaults(defineProps<Props>(), { accent:'soft' });
const attrs = useAttrs();

const myRange = cva('base classes…', {
  variants: { accent: { soft:'border-primary-200', loud:'border-primary-500' } },
});

const cls = computed(() => myRange({ accent: props.accent, class: attrs.class as string | undefined }));
</script>

Runtime events

Byteion keeps framework APIs idiomatic: HTML uses DOM custom events, React uses callback props, and Vue uses emitted events / v-model updates.

HTML / JS events

No HTML runtime events are declared by this adapter.

React callbacks

  • onValueChange(from: number, to: number) => void

Vue emits

  • update:modelValue[value: number]

Remote / AJAX

This component does not implement Byteion JS remote loading. Use normal HTML form submission, framework state, or your application data layer around it.

API Reference

Native range input.

HTML Data Attributes

No custom data attributes required.

React Props · RangeProps

Extracted directly fromreact/src/components/Range.tsx.

export interface RangeProps
  extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'defaultValue' | 'onChange' | 'size'> {
  value?: number;
  defaultValue?: number;
  onValueChange?: (value: number) => void;
  /** Visible label rendered above the slider. */
  label?: ReactNode;
  /** Optional value display rendered next to the label. */
  showValue?: boolean | ((value: number) => ReactNode);
  /** Accent tone. */
  tone?: keyof typeof ACCENT;
  /** Optional step labels rendered below the input (stepped variant). */
  steps?: ReactNode[];
  /** Optional value suffix (e.g. "%"). */
  suffix?: string;
}

Vue Props · RangeProps

Extracted directly fromvue/src/components/Range.vue.

export interface RangeProps {
  /** Controlled value. */
  modelValue?: number;
  /** Initial value when uncontrolled. */
  defaultValue?: number;
  min?: number;
  max?: number;
  step?: number;
  /** Visible label rendered above the slider. */
  label?: string;
  /** Show numeric value badge next to the label. */
  showValue?: boolean;
  /** Accent tone. */
  tone?: RangeTone;
  /** Optional step labels rendered below the input (stepped variant). */
  steps?: string[];
  /** Optional value suffix (e.g. "%"). */
  suffix?: string;
  id?: string;
}

Developer tips

• Edge case: on touch devices, ensure thumb is at least 44px for touch target.

Common mistakes

Avoid hardcoded neutral colors, placeholder-only labels, duplicated primary actions, and missing keyboard states. Keep this component on Byteion tokens so dashboard, admin, POS, ERP, ecommerce back-office, Laravel, React, and Vue starter-kit screens can be rebranded without rewriting markup.

Production usage tips

Use the canonical HTML as the source of truth, keep React and Vue wrappers aligned with the documented variants, test dark mode and branded themes before release, and wire interactive behavior through data-bi-* attributes instead of styling hooks.

Premium examples

Advanced patterns available in Byteion Pro:

• Double-thumb range for min/max selection • Animated fill with snap points

Unlock Premium Patterns

Get access to copy-paste ready Pro blocks, SaaS templates, and advanced data-tables built with this component.

Explore Pro Components