react-segmented-picker
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

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;

Package Sidebar

Install

npm i react-segmented-picker

Weekly Downloads

3

Version

1.4.0

License

MIT

Unpacked Size

19.3 kB

Total Files

6

Last publish

Collaborators

  • jeffwu