Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface TagsInputProps {
classNames?: {
input?: string;
tag?: string;
container?: string;
};
}

Expand Down Expand Up @@ -56,7 +57,7 @@ export const TagsInput = ({
}
}, [value]);

const handleOnKeyUp = e => {
const handleOnKeyUp = (e) => {
e.stopPropagation();

const text = e.target.value;
Expand Down Expand Up @@ -84,14 +85,17 @@ export const TagsInput = ({
}
};

const onTagRemove = text => {
setTags(tags.filter(tag => tag !== text));
const onTagRemove = (text) => {
setTags(tags.filter((tag) => tag !== text));
onRemoved && onRemoved(text);
};

return (
<div aria-labelledby={name} className="rti--container">
{tags.map(tag => (
<div
aria-labelledby={name}
className={cc("rti--container", classNames?.container)}
>
{tags.map((tag) => (
<Tag
key={tag}
className={classNames?.tag}
Expand Down