0.9.16 • Published 5 years ago

@paprika/listbox v0.9.16

Weekly downloads
1,679
License
MIT
Repository
github
Last release
5 years ago

@paprika/listbox - 0.9.15-alpha.1

Description

The ListBox component allows users to select one or more options from a list contained within the component

Installation

yarn add @paprika/listbox

or with npm:

npm install @paprika/listbox

Props

ListBox

PropTyperequireddefaultDescription
childrennodetrue-Child of type <ListBox.Option />
hasImplicitAllboolfalse-Has implicit "All items selected" value when no item is selected
heightnumbertrue-Indicate which is the height for the options container
isDisabledboolfalse-Disables the ListBox if true
isInlineboolfalse-This options will display the listbox without the Popover
isMultiboolfalse-Let the user to select multiple options at same time
isOpenboolfalse-Indicates if the popover is visible
onChangefuncfalse-Callback returning the current selection on the ListBox
placeholderstringtrue-Defaults label to display when the ListBox has not option selected
size ListBoxContainer.types.size.SMALL, ListBoxContainer.types.size.MEDIUM, ListBoxContainer.types.size.LARGEfalse-Size of the trigger and options (font size, height, padding, etc).

Box

PropTyperequireddefaultDescription
childrennodetrue-Body content of the box.

ListBox.Divider

PropTyperequireddefaultDescription
isDisabledboolfalsetrueisDisable is use internally as a default prop

the prop is read by the option/helpers/optionState.js which is assigned in the store it helps to ignore the divider while using the keyboard. see: options/helpers/options.js| |children|node|false|null| |

ListBox.Filter

PropTyperequireddefaultDescription
a11yTextstringfalsenullDescriptive a11y text for assistive technologies. By default, text from children node will be used.
filterfuncfalsenullFilters the list
hasSearchIconboolfalsetrueIf true displays a search icon
noResultsMessagestringfalsenullMessage displayed if no results are found
onChangeFilterfuncfalsenullCallback to be executed when the value is changed
onKeyDownfuncfalsenullCallback to be executed when a key is pressed
placeholderstringfalsenullDisplays a placeholder
renderFilterfuncfalsenullRender function for filter
valuestringfalsenullSets a value for filter

ListBox.Footer

PropTyperequireddefaultDescription
isAcceptVisibleboolfalsetrueIf true it makes the accept button visible
isCancelVisibleboolfalsetrueIf true it makes the cancel button visible
isClearVisibleboolfalsetrueIf true it makes the clear button visible
isDisabledboolfalsefalseIf true it makes the footer disabled
kindAccept Button.types.kind.PRIMARY, Button.types.kind.MINORfalseButton.types.kind.PRIMARYSets what kind the accept button will be
kindCancel Button.types.kind.PRIMARY, Button.types.kind.MINORfalseButton.types.kind.MINORSets what kind the cancel button will be
kindClear Button.types.kind.PRIMARY, Button.types.kind.MINORfalseButton.types.kind.MINORSets what kind the cancel button will be
labelAcceptstringfalse"Accept"Sets the label for the accept button
labelCancelstringfalse"Cancel"Sets the label for the cancel button
labelClearstringfalse"Clear"Sets the label for the clear button
onClickAcceptfuncfalsenullCallback to be executed when the accept button is clicked or activated by keyboard.
onClickCancelfuncfalsenullCallback to be executed when the cancel button is clicked or activated by keyboard.
onClickClearfuncfalsenullCallback to be executed when the clear button is clicked or activated by keyboard.
renderExtraButtonfuncfalse() => {}Render an extra button beside the clear button
size Button.types.size.SMALL, Button.types.size.MEDIUM, Button.types.size.LARGEfalseButton.types.size.SMALLDetermines the size of the footer

ListBox.Option

PropTyperequireddefaultDescription
childrennode,functrue-String, number or JSX content
isSelectedboolfalsenull
defaultIsSelectedboolfalsenullDescribe if the option started as selected or not
isDisabledboolfalsefalseDescribe if the option is enable or not
isHiddenboolfalsefalseDescribe if the option is hidden or not
labelstringfalsenullWhen the children are not a String, label should need to be add so the filter can work
onClickfuncfalsenullCallback for the clicking event
valueanyfalsenullValue of your option this can be any data structure
preventDefaultOnSelect-falsefalse

ListBox.Popover

PropTyperequireddefaultDescription
childrennodefalse-Body content of the PopOver.
zIndexnumberfalse100Sets the z-index value of the PopOver

ListBox.RawItem

PropTyperequireddefaultDescription
preventDefaultOnSelect-falsetrue

ListBox.Trigger

PropTyperequireddefaultDescription
clearIconnodefalsenullCustom clear icon
childrennode,funcfalse<React.Fragment />Body content of the trigger.
hasClearButtonboolfalsetrueIf true it adds a clear button
hasImplicitAllboolfalsefalseHas implicit "All items selected" value when no item is selected
labelstringfalsenullOverride the label with a custom one.
onClickClearfuncfalsenullCallback to be executed when the clear button is clicked or activated by keyboard.
onClickFooterAcceptfuncfalsenullCallback to be executed when the accept button is clicked or activated by keyboard.
placeholderstringfalse"Select..."Sets a placeholder for the trigger
isHiddenboolfalsefalseIf true the trigger will be hidden

For a basic ListBox

import ListBox from "@paprika/listbox";

function Component() {
  return (
    <ListBox onChange={changeHandler}>
      <ListBox.Option>Option 1</ListBox.Option>
      <ListBox.Option>Option 2</ListBox.Option>
    </ListBox>
  );
}

With Filter

import ListBox from "@paprika/listbox";

function Component() {
  return (
    <ListBox onChange={changeHandler}>
      <ListBox.Filter />
      <ListBox.Option>Option 1</ListBox.Option>
      <ListBox.Option>Option 2</ListBox.Option>
    </ListBox>
  );
}

Links

0.9.16

5 years ago

0.9.15-alpha.5

5 years ago

0.9.15-alpha.4

5 years ago

0.9.15-alpha.3

5 years ago

0.9.15-alpha.2

5 years ago

0.9.15-alpha.1

5 years ago

0.9.15-alpha.0

5 years ago

0.9.14

5 years ago

0.9.12

5 years ago

0.9.13

5 years ago

0.9.11

5 years ago

0.9.10

5 years ago

0.9.9

5 years ago

0.9.8

5 years ago

0.9.7

5 years ago

0.9.6

5 years ago

0.9.5

5 years ago

0.9.4

5 years ago

0.9.3

5 years ago

0.9.2

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.8.45

5 years ago

0.8.44

5 years ago

0.8.43

5 years ago

0.8.41

5 years ago

0.8.40

5 years ago

0.8.42

5 years ago

0.8.39

5 years ago

0.8.38

5 years ago

0.8.37

5 years ago

0.8.36

5 years ago

0.8.35

5 years ago

0.8.34

5 years ago

0.8.33

5 years ago

0.8.32

5 years ago

0.8.31

5 years ago

0.8.30

5 years ago

0.8.29

5 years ago

0.8.28

5 years ago

0.8.27

5 years ago

0.8.26

5 years ago

0.8.25

5 years ago

0.8.24

5 years ago

0.8.23

5 years ago

0.8.22

5 years ago

0.8.21

5 years ago

0.8.20

5 years ago

0.8.19

5 years ago

0.8.18

5 years ago

0.8.17

5 years ago

0.8.16

5 years ago

0.8.15

5 years ago

0.8.14

5 years ago

0.8.13

5 years ago

0.8.12

5 years ago

0.8.11

5 years ago

0.8.10

5 years ago

0.8.9

5 years ago

0.8.8

5 years ago

0.8.7

5 years ago

0.8.6

5 years ago

0.8.5

5 years ago

0.8.4

5 years ago

0.8.3

5 years ago

0.8.2

5 years ago

0.8.1

5 years ago

0.8.0

5 years ago

0.7.10

5 years ago

0.7.9

5 years ago

0.7.8

6 years ago

0.7.7

6 years ago

0.7.6

6 years ago

0.7.5

6 years ago

0.7.4

6 years ago

0.7.3

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.8

6 years ago

0.6.7

6 years ago

0.6.6

6 years ago

0.6.5

6 years ago

0.6.4

6 years ago

0.6.3

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.14

6 years ago

0.5.13

6 years ago

0.5.12

6 years ago

0.5.11

6 years ago

0.5.10

6 years ago

0.5.9

6 years ago

0.5.8

6 years ago

0.5.7

6 years ago

0.5.6

6 years ago

0.5.5

6 years ago

0.5.4

6 years ago

0.5.3

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago