Skip to main content
Neighborhood Design System v5.1.0

Range

Ready

A slider control that allows users to select a value within a specified range.

Preview

Open in Storybook (opens in new tab)

Code

Install
npm install @fbin-web/neighborhood-core
Import
import { NbhdRange } from '@fbin-web/neighborhood-core';
Usage
<nbhd-range
  aria-label="Descriptive text about this input"
  min="0"
  value=""
  name="range"
  help-text="This is some help text for the range input."
  error-text="This is some error text for the range input."
  step="5"
  label="Range form input">
</nbhd-range>

Properties

PropertyAttributeTypeDefaultDescription
surfacesurfacenoneprimarysecondaryinverseinverse-secondaryprimarySets the surface color treatment for the range input.
invalidinvalidbooleanfalseMarks the range input as invalid for validation.
disableddisabledbooleanfalseDisables the range input.
requiredrequiredbooleanfalseMarks the range input as required.
readonlyreadonlybooleanfalseShows the value but blocks changes, and is announced as read-only.
showValueshow-valuebooleanfalseDisplays the current value next to the range slider.
minminnumber0Sets the range input minimum value.
maxmaxnumber100Sets the range input maximum value.
stepstepnumber1Sets the range input step value.
valuevaluenumber—Sets the current value of the range input.
namenamestring—Sets the range input name. The form field name it submits under.
labellabelstring—The label text for the range input.
errorTexterror-textstring—Error message text to display when invalid. Defaults to "This field has an error." when empty.
helpTexthelp-textstring—Help text to provide additional context.
cssClasscss-classstring—Additional CSS classes to apply to the range input.
ariaLabelaria-labelstring—Descriptive text for additional context.

Events

NameDescriptionEvent Detail
nbhd-value-changedEmitted when the range value changes after the native input event is handled.{ value: number | undefined }

Form methods

Form-associated: inside a

it submits under its `name`, resets with the form, is disabled by a disabled
, and reports the inner range input’s native validity (`invalid` only shows the error state). A page-level

Slots

NameDescription
labelCustom label content rendered inside the form-control label. Falls back to the `label` property when no slot content is provided.
helpOptional helper text displayed below the range when the control is not invalid and help text is present.
errorOptional error text displayed below the range only when the control is invalid and error text is present.

CSS Parts

NameDescription
baseThe outer form-control container that wraps the range label, field, and helper/error text.
labelThe label element associated with the range input.
label-slotThe slot wrapper inside the label used for custom label content.
label-textThe text element that renders the fallback label content.
requiredThe required marker (*) shown in the label when required. Hidden from assistive technology, which announces the native required state.
fieldThe wrapper div surrounding the range input and optional value output.
inputThe native range input element.
textThe container that wraps help and error messaging.
helpThe help slot element shown when the range is not invalid.
errorThe error slot element shown when the range is invalid.
nbhd-range::part(base) {
  /* your styles */
}

CSS Properties

Set these on nbhd-range or an ancestor to override the defaults. Token is the design token a default comes from and Value is what it resolves to in core Neighborhood; brands may override them. Properties that adapt to surface follow the light or inverse surface they sit on until you set them.

Range

PropertyTokenValue Copy
--nbhd-range-appearance—none
--nbhd-range-blockSize--nbhd-size-track8px
--nbhd-range-disabled-host-opacity—0.5
--nbhd-range-focus-outlineColor--nbhd-context-color-focus-outlineAdapts to surface
--nbhd-range-focus-outlineOffset—1px
--nbhd-range-focus-outlineStyle--nbhd-focus-control-outlineStylesolid
--nbhd-range-focus-outlineWidth--nbhd-focus-outlineWidth2px
--nbhd-range-host-display—block
--nbhd-range-inlineSize—100%
--nbhd-range-marginBlock--nbhd-space-28px
--nbhd-range-thumb-backgroundColor--nbhd-context-color-control-selected-indicatorAdapts to surface
--nbhd-range-thumb-borderRadius--nbhd-border-radius-full9999px
--nbhd-range-thumb-cursor—pointer
--nbhd-range-thumb-size—20px
--nbhd-range-track-backgroundColor--nbhd-context-color-control-borderAdapts to surface
--nbhd-range-track-blockSize--nbhd-size-track8px
--nbhd-range-track-borderRadius--nbhd-border-radius-sm2px
--nbhd-range-track-inlineSize—100%

Form control

PropertyTokenValue Copy
--nbhd-formControl-display—inline
--nbhd-formControl-field-appearance—none
--nbhd-formControl-field-borderRadius--nbhd-border-radius-none0
--nbhd-formControl-field-color--nbhd-context-color-control-foregroundAdapts to surface
--nbhd-formControl-field-display—inline-block
--nbhd-formControl-field-fontFamily--nbhd-typography-body-fontFamilysans-serif
--nbhd-formControl-field-fontSize--nbhd-typography-body-fontSize1rem
--nbhd-formControl-field-inlineSize—100%
--nbhd-formControl-field-position—relative
--nbhd-formControl-fontFamily--nbhd-typography-body-fontFamilysans-serif
--nbhd-formControl-host-display—block
--nbhd-formControl-label-color--nbhd-context-color-text-primaryAdapts to surface
--nbhd-formControl-label-display—block
--nbhd-formControl-label-fontFamily--nbhd-typography-label-fontFamilysans-serif
--nbhd-formControl-label-fontSize--nbhd-typography-label-fontSize1rem
--nbhd-formControl-label-fontWeight--nbhd-typography-label-fontWeight600
--nbhd-formControl-label-letterSpacing—inherit
--nbhd-formControl-label-marginBlock--nbhd-space-0 --nbhd-space-050px 2px
--nbhd-formControl-label-position—relative
--nbhd-formControl-label-textTransform—inherit
--nbhd-formControl-marginBlock--nbhd-space-00px
--nbhd-formControl-maxInlineSize—100%
--nbhd-formControl-paddingBlock--nbhd-space-00px
--nbhd-formControl-paddingInline--nbhd-space-00px
--nbhd-formControl-position—relative
--nbhd-formControl-required-gap--nbhd-space-052px
--nbhd-formControl-text-marginBlock--nbhd-space-1 --nbhd-space-04px 0px

Dependencies

Child components <nbhd-range> renders internally. Import them too when you tree-shake.

Esc
↑ ↓ to move↵ to open