import Chip from "@mui/material/Chip"; import TextField from "@mui/material/TextField"; import Autocomplete from "@mui/material/Autocomplete"; export interface Props { label: string; value?: string | string[]; options?: string[]; onChange: (v: string[]) => void; maxAllowed?: number; } export default function InputTextBubble({ value = "", label, options = [], onChange, maxAllowed, }: Props) { const selected = Array.isArray(value) ? value : value ? [value] : []; return { let cleanValue = v === null ? [] : Array.isArray(v) ? v : [v] if (maxAllowed) { cleanValue = cleanValue.slice(0, maxAllowed); } onChange(cleanValue) }} renderInput={params => } renderTags={(tagValue, getTagProps) => tagValue.map((option, index) => ( )) } /> }