const StyledTag = styled(Tag)<TagProps>( ({option}) => display: flex; align-items:…
- User
const StyledTag = styled(Tag)( ({option}) => ` display: flex; align-items: center; margin: 1px; font-size: {ofScreener ? "11px" : "13px"}; color: #000; background-color: {selectTags.filter(tag => tag.name === option)[0].color}; border: none; border-radius: 2px; box-sizing: content-box; padding: ${ofScreener ? "0 7px 0 7px" : "0 10px 0 10px"};
& span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } & svg { display: none; } &:hover { padding: ${ofScreener ? "0 2px 0 7px" : "0 2px 0 10px"}; & svg { display: block; font-size: ${ofScreener ? "15px" : "18px"}; cursor: pointer; margin-top: -1px; } } `, );<Autocomplete multiple options={tags.map(t => t.name)} freeSolo value={selectTags.map(s => s.name)} onChange={handleTagsChange}
renderTags={(value: string[], getTagProps) => { return value.map((option: any, index: number) => ( <span key={index}> <StyledTag label={truncate(option, 15)} option={option} {...getTagProps({index})} /> </span> )); }}нужно стили StyledTag добавить в renderValue в Select <Select multiple displayEmpty sx={{fontSize: 12}} value={personName} onChange={handleChange} input={} renderValue={(selected) => { return selected.join(', '); }}
в renderValue в Select <Select добавить стили StyledTag
- Assistant
Вот обновленный код с добавленными стилями
StyledTagвrenderValueвSelect:const StyledTag = styled(Tag)<TagProps>( ({option}) => ` display: flex; align-items: center; margin: 1px; font-size: ${ofScreener ? "11px" : "13px"}; color: #000; background-color: ${selectTags.filter(tag => tag.name === option)[0].color}; border: none; border-radius: 2px; box-sizing: content-box; padding: ${ofScreener ? "0 7px 0 7px" : "0 10px 0 10px"}; & span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } & svg { display: none; } &:hover { padding: ${ofScreener ? "0 2px 0 7px" : "0 2px 0 10px"}; & svg { display: block; font-size: ${ofScreener ? "15px" : "18px"}; cursor: pointer; margin-top: -1px; } } `, ); <Autocomplete multiple options={tags.map(t => t.name)} freeSolo value={selectTags.map(s => s.name)} onChange={handleTagsChange} renderTags={(value: string[], getTagProps) => { return value.map((option: any, index: number) => ( <span key={index}> <StyledTag label={truncate(option, 15)} option={option} {...getTagProps({index})} /> </span> )); }} renderValue={(selected) => { return ( <div> {selected.map((option: string, index: number) => ( <StyledTag key={index} label={option} option={option} /> ))} </div> ); }} </Autocomplete>
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.