Skip to content

Show existing tags as autocomplete suggestions 🏷️ #486

Description

@anoopcodehack

Show existing tags as autocomplete suggestions 🏷️

File: client/src/components/Task/TaskModal.jsx

Every time you type tags you retype
same ones from scratch πŸ’€ fr!!

Fix: collect existing tags for suggestions:
const existingTags = [...new Set(
tasks.flatMap(t => t.tags || [])
)]

const lastTag = form.tags.split(',').pop().trim()
const suggestions = lastTag.length > 0
? existingTags.filter(t =>
t.includes(lastTag) && t !== lastTag
)
: []

{suggestions.length > 0 && (

{suggestions.map(tag => ( { const tags = form.tags.split(',') tags[tags.length-1] = tag setForm({...form, tags: tags.join(',') + ','}) }} className="text-[10px] px-2 py-0.5 bg-[#2a2a2f] text-[#888] rounded-full hover:text-purple-400 transition"> + {tag} ))}
)}

~15 lines! No backend needed 🎯

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions