1.4.2 • Published 4 years ago

mui-downshift v1.4.2

Weekly downloads
2,015
License
MIT
Repository
github
Last release
4 years ago

mui-downshift

Thin layer over paypal's downshift to use Material-UI 1.0 visual components

For examples of <MuiDownshift> in action, see demo or view the source

Features

  • Uses windowing for performance (via react-virtualized)
  • Asynchronous loading of items
    • Infinite scrolling
    • Paginated loading
    • Delayed loading of items until menu is opened
  • Customizable rendering (see getListItem, getInputProps, etc)
  • Control opening menu on input focus (or only on explict toggle)
  • Control height of menu based on number of items or pixels
  • Dynamic row heights using react-virtualized's CellMeasurer
  • Uses a portal to solve the z-index / stacking context problem and Material-UI's popover z-index value
  • All other capabilities inherited from downshift

Props

PropertyTypeRequiredDescription
itemsArrayItems to show in menu
getListItemFunctionReturn an instance of Material-UI's <ListItem /> for each item. defaultProps implementation handles simple cases.
getListItemKeyFunctionIf defined, should return a deterministic key based on index within items, instead of just the default (default). Passed to react-virtualized's CellMeasurer keyMapper prop. Defining helps resolve an issue with menu changing size or the scroll position jumping around when appending more items. See the paginated fetch for an example.
getInputPropsFunctionCustomize look of Material-UI's <FormControl> and <Input />. Result of function is merged with Downshift's getInputProps
showEmptyBooleanIf true, will render a single item if items is empty. Will call getListItem (if defined) with a null item to handle display
includeFooterBooleanIf true, will render an additional item as the last item. Will call getListItem (if defined) with a null item to handle display. Useful for paginated scrolling (see demo) and showing loading status beyond the loading prop.
getInfiniteLoaderPropsFunctionIf provided, will wrap menu in react-virtualized InfiniteLoader and pass the props returned from the function. Be sure to provide all required props (isRowLoaded, rowCount, and loadMoreRows). Used for infinite scrolling (see demo).
getVirtualListPropsFunctionPass or override props provided to underlying react-virtualized List component. Note: Setting rowHeight will remove CellMeasurer usage, which is used to calculate heights dynamically. This can provide better performance, especially if set as a static value (ex. 48)
getRootPropsFunctionProvide props to the root element that wraps the input and menu components
menuItemCountNumberNumber of items to show on menu before scrolling. Default 5
menuHeightNumberNumber of pixels to set menu before scrolling. Overrides menuItemCount if set. Default null
loadingBooleanShow loading indicator
focusOnClearBooleanFocus input after clearing. See issue #9
all props available on downshiftitemToString, onChange, onStateChange, ...
variant'standard', 'filled', 'outlined'MUI input variant. Default 'standard'

Running Storybook

This project has some storybook stories.

To run storybook, you have to install the story dependencies first:

$ cd stories
$ yarn install
$ cd ..

Then use yarn to run the storybook script:

$ yarn storybook
1.4.2

4 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

1.0.0-17

6 years ago

1.0.0-16

6 years ago

1.0.0-15

6 years ago

1.0.0-14

6 years ago

1.0.0-13

6 years ago

1.0.0-12

6 years ago

1.0.0-11

6 years ago

1.0.0-10

6 years ago

1.0.0-9

6 years ago

1.0.0-8

6 years ago

1.0.0-7

6 years ago

1.0.0-6

6 years ago

1.0.0-5

6 years ago

1.0.0-4

6 years ago

1.0.0-3

6 years ago

1.0.0-2

6 years ago

1.0.0-1

6 years ago

1.0.0-0

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago