Skip to content

Commit

Permalink
Merge pull request #9 from harshzalavadiya/feat-customizable-classname
Browse files Browse the repository at this point in the history
customizable parent className
  • Loading branch information
harshzalavadiya authored Apr 22, 2020
2 parents 914c31e + a7fd684 commit 9289820
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,22 @@ export default Example;

## 👀 Props

| Prop | Description | Type | Default |
| --------------------- | ---------------------------------- | ------------------ | ------- |
| `labelledBy` | value for `aria-labelledby` | `string` | |
| `options` | options for dropdown | `[{label, value}]` | |
| `value` | pre-selected rows | `[{label, value}]` | `[]` |
| `focusSearchOnOpen` | focus on search input when opening | `boolean` | `true` |
| `hasSelectAll` | toggle 'Select All' option | `boolean` | `true` |
| `isLoading` | show spinner on select | `boolean` | `false` |
| `shouldToggleOnHover` | toggle dropdown on hover option | `boolean` | `false` |
| `overrideStrings` | Override default strings for i18n | `object` | |
| `onChange` | onChhange callback | `function` | |
| `disabled` | disable dropdown | `boolean` | `false` |
| `selectAllLabel` | _select all_ label | `string` | |
| `disableSearch` | hide search textbox | `boolean` | `false` |
| `filterOptions` | custom filter options | `function` | |
| Prop | Description | Type | Default |
| --------------------- | ---------------------------------- | ------------------ | -------------- |
| `labelledBy` | value for `aria-labelledby` | `string` | |
| `options` | options for dropdown | `[{label, value}]` | |
| `value` | pre-selected rows | `[{label, value}]` | `[]` |
| `focusSearchOnOpen` | focus on search input when opening | `boolean` | `true` |
| `hasSelectAll` | toggle 'Select All' option | `boolean` | `true` |
| `isLoading` | show spinner on select | `boolean` | `false` |
| `shouldToggleOnHover` | toggle dropdown on hover option | `boolean` | `false` |
| `overrideStrings` | Override default strings for i18n | `object` | |
| `onChange` | onChhange callback | `function` | |
| `disabled` | disable dropdown | `boolean` | `false` |
| `selectAllLabel` | _select all_ label | `string` | |
| `disableSearch` | hide search textbox | `boolean` | `false` |
| `filterOptions` | custom filter options | `function` | |
| `className` | class name for parent component | `string` | `multi-select` |

## 🌐 Internationalization

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-multi-select-component",
"version": "2.0.3",
"version": "2.0.4",
"description": "Simple and lightweight multiple selection dropdown component with checkboxes, search and select-all",
"author": "Harsh Zalavadiya",
"license": "MIT",
Expand Down
1 change: 1 addition & 0 deletions src/lib/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ export interface ISelectProps {
filterOptions?: (options: Option[], filter: string) => Option[];
overrideStrings?: { [key: string]: string };
labelledBy: string;
className?: string;
}
3 changes: 2 additions & 1 deletion src/multi-select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const MultiSelect = ({
focusSearchOnOpen = true,
hasSelectAll = true,
shouldToggleOnHover = false,
className = "multi-select",
options,
value,
valueRenderer,
Expand All @@ -45,7 +46,7 @@ const MultiSelect = ({
}: ISelectProps) => {
const nvalue = value || [];
return (
<div className={`${MultiSelectBox} multi-select`}>
<div className={`${MultiSelectBox} ${className}`}>
<Dropdown
isLoading={isLoading}
contentComponent={SelectPanel}
Expand Down
1 change: 1 addition & 0 deletions stories/default.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const toStorybook = () => {
disabled={boolean("disabled", false)}
onChange={setSelected}
labelledBy={text("labelledBy", "Select Fruits")}
className={text("className", "multi-select")}
/>
</div>
);
Expand Down

0 comments on commit 9289820

Please sign in to comment.