lion/packages/input-range
CircleCI 0afd2edb79 chore: release new versions
- @lion/checkbox-group@0.11.8
 - @lion/fieldset@0.14.1
 - @lion/form-core@0.3.1
 - @lion/form-integrations@0.2.1
 - @lion/form@0.6.15
 - @lion/input-amount@0.7.15
 - @lion/input-date@0.7.15
 - @lion/input-datepicker@0.14.19
 - @lion/input-email@0.8.15
 - @lion/input-iban@0.9.15
 - @lion/input-range@0.4.15
 - @lion/input@0.8.1
 - @lion/radio-group@0.11.8
 - @lion/select-rich@0.19.1
 - @lion/select@0.7.15
 - @lion/switch@0.10.16
 - @lion/textarea@0.7.15
 - @lion/validate-messages@0.2.7
2020-07-28 12:58:54 +00:00
..
src chore: move icon intro to icon package so it can be extended 2020-06-08 11:27:26 +02:00
test chore: cleanup tests of all registration based awaits 2020-07-28 14:50:10 +02:00
CHANGELOG.md chore: release new versions 2020-07-28 12:58:54 +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-07-28 12:58:54 +00:00
README.md chore: fix more links for storybook 2020-06-04 19:05:25 +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>
`;

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>
`;