Slider

A Slider component for displaying current value and intervals in range.

Notice

  • Ingored exclusiveMinimum, exclusiveMaximum

Examples

Basic Usage

Simplest of usage.

expand codeexpand code
import { Component } from '@angular/core';
import { SFSchema, SFSliderWidgetSchema } from '@delon/form';
import { NzMessageService } from 'ng-zorro-antd/message';

@Component({
  selector: 'form-slider-simple',
  template: ` <sf [schema]="schema" (formSubmit)="submit($event)"></sf> `,
})
export class FormSliderSimpleComponent {
  schema: SFSchema = {
    properties: {
      count: {
        type: 'number',
        title: '数量',
        ui: {
          widget: 'slider',
        } as SFSliderWidgetSchema,
        default: 10,
      },
      // 双滑块模式
      range: {
        type: 'number',
        title: '范围',
        ui: {
          widget: 'slider',
          range: true,
        } as SFSliderWidgetSchema,
        default: [10, 20],
      },
    },
  };

  constructor(private msg: NzMessageService) {}

  submit(value: {}): void {
    this.msg.success(JSON.stringify(value));
  }
}

API

schema

PropertyDescriptionTypeDefault
[minimum]The minimum value the slider can slide tonumber0
[maximum]The maximum value the slider can slide tonumber100
[multipleOf]The granularity the slider can step through values. Must greater than 0, and be divided by (max - min). When ui.marks no null, step can be null.number1

ui

PropertyDescriptionTypeDefault
[range]dual thumb modeBoolean-
[marks]Tick mark of Slider, type of key must be number, and must in closed interval [min, max] ,each mark can declare its own style.NzMarks-
[dots]Whether the thumb can drag over tick onlyBooleanfalse
[included]Make effect when marks not null,true means containment and false means coordinativeBooleantrue
[vertical]If true, the slider will be verticalbooleanfalse
[afterChange]Fire when onmouseup is fired.(value: NzSliderValue) => void-
[formatter]Slider will pass its value to nzTipFormatter, and display its value in Tooltip, and hide Tooltip when return value is null(value: number) => string-