How add wrap "div" for MultivalueContainer when use isMulti? #5355
Unanswered
nodir-sulaymonov
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Its my code. But i cant add wrap for this component.
//MultivalueContainer.tsx
type SelectedType = T & {
label: string;
value: string;
};
function MultiValueContainer<T, IsMulti extends boolean, Group extends GroupBase>({
data,
selectProps,
}: MultiValueGenericProps<T, IsMulti, Group>): JSX.Element {
const labelName = data.label;
const allSelected = selectProps.value as SelectedType[];
//#5152
const lastDropdownOption = allSelected[allSelected.length - 1];
const isLastValue = lastDropdownOption.label === labelName;
const labelSuffix = isLastValue ? '' : ', ';
return (
<>
{labelName}{labelSuffix}
</>
);
}
//index.tsx
import React, { ReactElement } from 'react';
import DropdownIndicator from './DropdownIndicator';
import MenuList from './MenuList';
import ClearIndicator from './ClearIndicator';
import Option from './Option';
import MultiValueContainer from './MultiValueContainer';
export const selectComponents = {
DropdownIndicator,
Option,
MenuList,
ClearIndicator,
MultiValueContainer,
IndicatorSeparator: (): ReactElement => <></>,
};
I did this one on Browser.
Beta Was this translation helpful? Give feedback.
All reactions