Socket
Socket
Sign inDemoInstall

react-native-radial-slider

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-radial-slider

React Native component to select or highlight a specific value from a range of values


Version published
Weekly downloads
727
increased by23.01%
Maintainers
1
Install size
121 kB
Created
Weekly downloads
 

Readme

Source

Radial Slider - Simform

react-native-radial-slider

react-native-radial-slider on npm react-native-radial-slider downloads react-native-radial-slider install size Android iOS MIT


This is a pure javascript and react-native-svg based library that provides many variants of Radial Slider and Speedo Meter including default, radial-circle-slider, speedometer and speedometer-marker

Radial Slider allows you to select any specific value from a range of values. It comes with two variants, one is default which allows selection on a 180-degree arc and the second one is 360-degree which allows selection of values on a complete circle. It can be used to select/set goals, vision, range, etc.

The Speedo Meter allows you to highlight a specific value from a range of values. It comes with two variants, the default one shows a needle and another one shows marking values with a needle. It can be used to display the speed of the internet, vehicle, fan, etc.

This library is easy to use and provides you complete customization, so you can customize components based on your need.

🎬 Preview

RadialSliderSpeedoMeter
alt RadialSlideralt SpeedoMeter

Quick Access

Installation | RadialSlider | SpeedoMeter | Properties | Example | License

Installation

1. Install library and react-native-svg
$ npm install react-native-radial-slider react-native-svg
# --- or ---
$ yarn add react-native-radial-slider react-native-svg
2. Install cocoapods in the ios project
cd ios && pod install
Know more about react-native-svg

RadialSlider

  • RadialSlider has two different variants, 'default' and 'radial-circle-slider'
  • RadialSlider can be used to select / set goal, vision, range etc

Default RadialSlider

🎬 Preview

Default RadialSlider

Usage

import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { RadialSlider } from 'react-native-radial-slider';

const RadialVariant = () => {
  const [speed, setSpeed] = useState(0);

  return (
    <View style={styles.container}>
      <RadialSlider value={speed} min={0} max={200} onChange={setSpeed} />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
});

export default RadialVariant;

Radial Circle Slider

🎬 Preview

Default RadialCircleSlider

Usage

import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { RadialSlider } from 'react-native-radial-slider';

const RadialVariant = () => {
  const [speed, setSpeed] = useState(0);

  return (
    <View style={styles.container}>
      <RadialSlider
        variant={'radial-circle-slider'}
        value={speed}
        min={0}
        max={200}
        onChange={setSpeed}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
});

export default RadialVariant;

SpeedoMeter

The speedometer will not take user inputs, when we need to update dynamic values at that time we can use it

  • SpeedoMeter has two different variants, speedometer and speedometer-marker
  • SpeedoMeter can be used to display the speed of an internet, vehicle, fan etc

SpeedoMeter

🎬 Preview

Default SpeedoMeter

Usage

import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { RadialSlider } from 'react-native-radial-slider';

const SpeedoMeterVariant = () => {
  const [speed, setSpeed] = useState(0);

  return (
    <View style={styles.container}>
      <RadialSlider
        variant={'speedometer'}
        value={speed}
        min={0}
        max={200}
        onChange={setSpeed}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
});

export default SpeedoMeterVariant;

SpeedoMeter Marker

🎬 Preview

Default SpeedoMeterMarker

Usage

import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { RadialSlider } from 'react-native-radial-slider';

const SpeedoMeterVariant = () => {
  const [speed, setSpeed] = useState(0);

  return (
    <View style={styles.container}>
      <RadialSlider
        variant={'speedometer-marker'}
        value={speed}
        min={0}
        max={200}
        onChange={setSpeed}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
});

export default SpeedoMeterVariant;

Properties

PropDefaultTypeDescriptionRadialSliderSpeedoMeter
min*0numberMinimum value
max*100numberMaximum value
value*0numberShow selection upto this value
onChange*-functionCallback function that invokes on change in track
radius100numberSize of component
startAngle270number [1-360]The angle at which the circular slider should start from.
step1numberStep value for component
markerValue-numberShow marker on specific number
title-stringTitle for component
subTitleGoalstringSubtitle for component
unitRadialSlider: 'kCal', SpeedoMeter: 'MB/S'stringUnit for component
thumbRadius18numberRadius for thumb
thumbColor#008ABCstringColor for thumb
thumbBorderWidth5numberWidth for thumb
thumbBorderColor#FFFFFFstringBorder Color for thumb
markerLineSize50numberSize of marker line
sliderWidth18numberWidth of slider
sliderTrackColor#E5E5E5stringColor of unselected slider track
lineColor#E5E5E5stringColor of unselected lines
lineSpace3numberSpace between each line
linearGradient[ { offset: '0%', color:'#ffaca6' }, { offset: '100%', color: '#EA4800' }]objectGradient color of selected track
onComplete-functionCallback function which defines what to do after completion
centerContentStyle{}objectCenter content style
titleStyle{}objectStatus title container style
subTitleStyle{}objectStatus subtitle text style
valueStyle{}objectCenter value style
buttonContainerStyle{}objectButton container style
leftIconStyle{}objectLeft Icon style
rightIconStyle{}objectRight Icon style
contentStyle{}objectWhole content style
unitStyle{}objectUnit text style
style{}objectInner container style
openingRadianRadialSlider: Math.PI / 3 , SpeedoMeter:0.057numberRadian of component
disabledfalsebooleanIf true, buttons will be in disabled state
isHideSliderfalsebooleanIf true, slider will be hidden
isHideCenterContentfalsebooleanIf true, center content will be hidden
isHideTitlefalsebooleanIf true, title will be hidden
isHideSubtitlefalsebooleanIf true, subtitle will be hidden
isHideValuefalsebooleanIf true, value will be hidden
isHideTailTextfalsebooleanIf true, tail text will be hidden
isHideButtonsfalsebooleanIf true, buttons will be hidden
isHideLinesfalsebooleanIf true,slider lines will be hidden
isHideMarkerLinefalsebooleanIf true, marked lines will be hidden
fixedMarkerfalsebooleanIf true, marked value will be hidden
variantdefaultstringDifferent component variants radial-circle-slider, speedometer, speedometer-marker
onPress{}functionBased on click value will be increased or decreased
stroke'#008ABC'stringColor for button icon
unitValueContentStyle{}objectUnit value content style
markerCircleSize15numberSize for marker circle
markerCircleColor#E5E5E5stringColor for marker circle
markerPositionY20numberMarker position for up and down
markerPositionX20numberMarker position for right and left
needleBackgroundColor#A020F0stringBackground color for needle
needleColor#175BADstringColor for needle
needleBorderWidth1.5numberWidth of needle border
needleHeight30numberHeight of needle
markerValueInterval10numberShow number of value in sequence
markerValueColor#333333stringColor for marker value
strokeLinecapbuttstringLine terminations, can be butt, line, or square

Example

A full working example project is here Example

yarn
yarn example ios   // For ios
yarn example android   // For Android

Find this library useful? ❤️

Support it by joining stargazers for this repository.⭐

🤝 How to Contribute

We'd love to have you improve this library or fix a problem 💪 Check out our Contributing Guide for ideas on contributing.

Bugs / Feature requests / Feedbacks

For bugs, feature requests, and discussion please use GitHub Issues

License

Keywords

FAQs

Last updated on 20 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc