lion/packages/input-range
2021-02-15 18:07:33 +01:00
..
src fix: minimise deps by moving integration demos to integration packages 2021-01-06 16:34:03 +01:00
test fix: use lion/core types wherever possible 2020-11-09 14:04:05 +01:00
CHANGELOG.md Version Packages 2021-01-26 10:28:00 +00:00
custom-elements.json docs: add custom elements manifest 2021-02-15 18:07:33 +01: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 docs: add custom elements manifest 2021-02-15 18:07:33 +01:00
README.md fix: normalize dependencies 2021-01-06 10:53:38 +01: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 '@lion/core';

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