lion/packages/input-range
CircleCI 94b87c80f5 chore: release new versions
- @lion/ajax@0.4.0
 - babel-plugin-extend-docs@0.2.0
 - @lion/button@0.7.0
 - @lion/calendar@0.9.0
 - @lion/checkbox-group@0.10.0
 - @lion/dialog@0.7.0
 - @lion/fieldset@0.13.0
 - @lion/form-core@0.1.0
 - @lion/form-integrations@0.1.0
 - @lion/form@0.6.0
 - @lion/icon@0.6.0
 - @lion/input-amount@0.7.0
 - @lion/input-date@0.7.0
 - @lion/input-datepicker@0.14.0
 - @lion/input-email@0.8.0
 - @lion/input-iban@0.9.0
 - @lion/input-range@0.4.0
 - @lion/input@0.7.0
 - @lion/localize@0.11.0
 - @lion/overlays@0.16.0
 - @lion/radio-group@0.10.0
 - @lion/select-rich@0.18.0
 - @lion/select@0.7.0
 - @lion/steps@0.5.0
 - @lion/switch@0.10.0
 - @lion/tabs@0.4.0
 - @lion/textarea@0.7.0
 - @lion/tooltip@0.11.0
 - @lion/validate-messages@0.1.0
2020-05-29 15:03:48 +00:00
..
src fix(input-range): securely apply css 2020-04-16 09:58:03 +02:00
test feat(input-range): create input-range component 2019-12-16 17:41:14 +01:00
CHANGELOG.md chore: release new versions 2020-05-29 15:03:48 +00:00
index.js feat(input-range): create input-range component 2019-12-16 17:41:14 +01:00
lion-input-range.js feat(input-range): create input-range component 2019-12-16 17:41:14 +01:00
package.json chore: release new versions 2020-05-29 15:03:48 +00:00
README.md chore: updated dep versions and made compatible 2020-05-29 17:01:15 +02:00

Input range

lion-input-range component is based on the native range input. Its purpose is to provide a way for users to select one value from a range of values.

import { html } from 'lit-html';

import './lion-input-range.js';

export default {
  title: 'Forms/Input Range',
};
export const main = () => html`
  <lion-input-range min="200" max="500" .modelValue="${300}" label="Input range"></lion-input-range>
`;

Live Demo/Documentation

See our storybook for a live demo and API documentation

Features

  • Based on lion-input.
  • Shows modelValue and unit above the range input.
  • Shows min and max value after the range input.
  • Can hide the min and max value via no-min-max-labels.
  • Makes use of formatNumber for formatting and parsing.

How to use

Installation

npm i --save @lion/input-range
import { LionInputRange } from '@lion/input-range';
// or
import '@lion/input-range/lion-input-range.js';

Examples

Units

export const units = () => html`
  <style>
    lion-input-range {
      max-width: 400px;
    }
  </style>
  <lion-input-range
    min="0"
    max="100"
    .modelValue="${50}"
    unit="%"
    label="Percentage"
  ></lion-input-range>
`;

Steps

export const steps = () => html`
  <lion-input-range
    style="max-width: 400px;"
    min="200"
    max="500"
    step="50"
    .modelValue="${300}"
    label="Input range"
    help-text="This slider uses increments of 50"
  ></lion-input-range>
`;

Without Min Max Labels

export const noMinMaxLabels = () => html`
  <lion-input-range
    style="max-width: 400px;"
    no-min-max-labels
    min="0"
    max="100"
    label="Input range"
  ></lion-input-range>
`;

Disabled

export const disabled = () => html`
  <lion-input-range
    style="max-width: 400px;"
    disabled
    min="200"
    max="500"
    .modelValue="${300}"
    label="Input range"
  ></lion-input-range>
`;