Skip to content
v0.9.1
Forms

Slider

Pick a number by dragging. It is the native <input type="range"> with the class .slider, so arrow keys, Home/End, PgUp/PgDn, forms and screen readers all work. momo.js paints the filled part and shows the value.

Basic

<input class="slider" type="range" min="0" max="100" value="40" aria-label="Volume">

With a label and value

Put an <output for="id"> anywhere: it shows the value as you drag. data-prefix and data-suffix add text around the number.

1,200
<div class="slider-field">
  <div class="slider-head">
    <label class="form-label" for="sl-budget">Monthly budget</label>
    <output class="slider-output" for="sl-budget" data-prefix="$">1,200</output>
  </div>
  <input class="slider" id="sl-budget" type="range" min="0" max="5000" step="100" value="1200">
</div>

Steps with labels

Add a .slider-ticks row under it. Each label sits under its spot, so use one label per step.

10
<div class="slider-field">
  <div class="slider-head">
    <label class="form-label" for="sl-size">Team size</label>
    <output class="slider-output" for="sl-size" data-suffix=" people">10</output>
  </div>
  <div>
    <input class="slider" id="sl-size" type="range" min="0" max="50" step="10" value="10">
    <div class="slider-ticks" aria-hidden="true"><span>0</span><span>10</span><span>20</span><span>30</span><span>40</span><span>50</span></div>
  </div>
</div>

Min and max

Two sliders inside .slider-range share one track, for price and date filters. The thumbs never pass each other. Give each one its own aria-label.

Price 20 to 80
<div class="slider-field">
  <div class="slider-head">
    <span class="form-label">Price</span>
    <span class="slider-output"><output for="sl-lo" data-prefix="$">20</output> to <output for="sl-hi" data-prefix="$">80</output></span>
  </div>
  <div class="slider-range">
    <input class="slider" id="sl-lo" type="range" min="0" max="100" value="20" aria-label="Lowest price">
    <input class="slider" id="sl-hi" type="range" min="0" max="100" value="80" aria-label="Highest price">
  </div>
</div>

Icons on both ends

<div class="slider-row">
  <i class="mi mi-volume-1" aria-hidden="true"></i>
  <input class="slider slider-round" type="range" min="0" max="10" value="6" aria-label="Volume">
  <i class="mi mi-volume-2" aria-hidden="true"></i>
</div>

Colors, shapes and sizes

.slider-<color> for any color, .slider-round for a round thumb, .slider-sm and .slider-lg. On touch screens the thumb grows so it is easy to grab.

<div class="form-grid">
  <input class="slider slider-sm slider-green" type="range" value="30" aria-label="Small green">
  <input class="slider slider-violet" type="range" value="50" aria-label="Violet">
  <input class="slider slider-lg slider-yellow slider-round" type="range" value="70" aria-label="Large yellow">
  <input class="slider" type="range" value="45" disabled aria-label="Disabled">
</div>

JavaScript

Listen to the native input (while dragging) and change (when let go) events. If you set value in code, call Momo.slider.refresh(input) so the fill and the output follow. Form resets are handled for you.

const s = document.querySelector('#sl-budget');
s.value = 2500;
Momo.slider.refresh(s);

Accessibility

Variables

VariableDefault
--slider-colorbrand
--slider-tracksurface
--slider-height.75rem
--slider-thumb1.5rem (1.75rem on touch)

Start

OverviewStart Getting startedStart CustomizeStart

Guides

AccessibilityGuides BreakpointsGuides ChangelogGuides Customize componentsGuides JavaScriptGuides MotionGuides OptimizeGuides PhonesGuides RebootGuides Right-to-left (RTL)Guides Stacking orderGuides Using Momo with AIGuides

Foundations

ColorsFoundations TypographyFoundations ProseFoundations Images & figuresFoundations CodeFoundations Lines & shadowsFoundations Dark modeFoundations

Forms

Checkbox & switchForms ComboboxForms Date pickerForms Date rangeForms Fields & labelsForms File uploadForms Floating labelsForms Number stepperForms PasswordForms PIN codeForms RatingForms SelectForms SliderForms Tag inputForms Time pickerForms ValidationForms

Components

AccordionComponents Alert & bannerComponents AvatarComponents BadgeComponents BreadcrumbComponents ButtonComponents Button groupComponents CalendarComponents CardComponents CarouselComponents ChartsComponents ChipsComponents CollapseComponents Command paletteComponents CommentsComponents Confirm dialogsComponents Cookie bannerComponents Data tableComponents Description listComponents Dialog & toastComponents DividerComponents DrawerComponents Dropdown menuComponents Empty stateComponents File managerComponents Filter & sortComponents Gallery & lightboxComponents Inbox & chatComponents Infinite scrollComponents KanbanComponents Keyboard shortcutsComponents List groupComponents MarqueeComponents Media objectComponents Nav overflowComponents Notification centerComponents PaginationComponents ProgressComponents Pull to refreshComponents SkeletonComponents SortableComponents SpinnerComponents Split viewComponents Stat cardComponents Steps & wizardComponents Swipe actionsComponents TableComponents TabsComponents TimelineComponents TogglerComponents Tooltip & popoverComponents TourComponents Tree viewComponents VideoComponents WhiteboardComponents

Layout

Announcement barLayout App shellLayout Back to topLayout Container & sectionLayout ExamplesLayout FooterLayout HeroLayout JumbotronLayout Mega menuLayout NavbarLayout Site sidebarLayout

Sections

Bento gridSections Blog cardsSections Call to actionSections Contact & newsletterSections FAQSections FeaturesSections Logo cloudSections PricingSections TeamSections TestimonialsSections

Utilities

OverviewUtilities State variantsUtilities Display & flexUtilities Grid & gapUtilities SpacingUtilities SizingUtilities TextUtilities Links & color strengthUtilities Position & overflowUtilities BackgroundsUtilities Borders & effectsUtilities Transforms & filtersUtilities InteractionsUtilities

Helpers

Fixed, sticky & frostedHelpers Hover & focusHelpers Hover revealHelpers Icon linkHelpers PrintHelpers Relative timeHelpers Screen reader textHelpers Scroll inHelpers ScrollspyHelpers Share buttonHelpers Skip linkHelpers StacksHelpers Stretched linkHelpers Theme toggleHelpers Truncated textHelpers

Page patterns

404 pagePage patterns Coming soonPage patterns Login & registerPage patterns SettingsPage patterns ProfilePage patterns CRM contactsPage patterns ProjectsPage patterns File manager pagePage patterns Billing & plansPage patterns Help centerPage patterns Mobile app screensPage patterns
↑ ↓ moveEnter openEsc close