1.4.0 • Published 3 years ago

react-segmented-picker v1.4.0

Weekly downloads
5
License
MIT
Repository
github
Last release
3 years ago

react-segmented-picker

Build Status

An iOS style segmented picker for react web

Demo (the bar next to "All Posts")

Install

npm i react styled-components --save-dev
npm i react-segmented-picker

or

yarn add react styled-components -D
yarn add react-segmented-picker

Usage

import React, { useState } from 'react';

import SegmentedPicker from 'react-segmented-picker';

// Demo App
function App() {
  const [selection, setSelection] = useState(0);
  const options = ['Apple', 'Orange', 'Pear', 'Watermelon'];

  return (
    <div className="App">
      <p>You selected</p>
      <p>#{selection}: {options[selection]}</p>

      <SegmentedPicker
        options={options}
        selection={selection}
        onSelectionChange={(newSelection) => {
          setSelection(newSelection);
        }}
      />
    </div>
  );
}

export default App;
1.4.0

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago