Skip to main content

TagList

Displays a filterable list of all tags across all bookmarks with their occurrence counts.

Props

This component has no props. It reads state from the BookmarkStore.

Usage

import TagList from './components/TagList'

<TagList />

Features

  • Auto-generated: Creates tag list from all bookmarks
  • Occurrence Count: Shows how many bookmarks have each tag
  • Active State: Highlights currently selected tag
  • Responsive Layout: Horizontal scroll on mobile, wrapped grid on desktop
  • Hidden When Empty: Returns null if no bookmarks exist

Tag Display

Each tag shows:
  • Tag name
  • Count of bookmarks with that tag (in gray)
  • Visual indication when selected (white background, dark text)

Example Output

// If bookmarks have tags: ["react", "javascript", "react", "css"]
// TagList renders:

<TagList />
// Shows:
// [all 4] [react 2] [javascript 1] [css 1]

Styling

  • Default: Dark background with light text
  • Selected: Light background with dark text
  • Hover: Border color transitions to lighter gray
  • Mobile: Horizontal scrollable with snap points
  • Desktop: Centered, wrapped layout

BookmarkTags

Interactive tag editor for individual bookmarks. Allows adding, removing, and editing tags directly on a bookmark.

Props

bookmark
Bookmark
required
The bookmark object to manage tags for. See Bookmark component for full type details.

Usage

import BookmarkTags from './components/BookmarkTags'

<BookmarkTags bookmark={bookmark} />

Features

  • Inline Editing: Click to edit tags directly on the bookmark card
  • Multiple Entry Methods: Add tags with comma or Enter key
  • Backspace Deletion: Press backspace when input is empty to edit last tag
  • Click to Remove: Click X icon on any tag to remove it
  • Duplicate Prevention: Won’t add duplicate tags
  • Click-outside to Cancel: Clicking outside cancels editing without saving
  • Empty State: Shows “add tags…” placeholder when no tags exist

Keyboard Interactions

  • Type tag name
  • Press , (comma) or Enter to add the tag
  • Tag is converted to lowercase and trimmed
  • Input is cleared for next tag
  • Click the × icon on any tag
  • Or press Backspace when input is empty to edit the last tag
  • Click the checkmark icon
  • Or press Enter when input is empty
  • Click outside the tag area
  • Changes are discarded and tags revert to original state

Example Interaction

// Initial state: bookmark has tags ["react", "tutorial"]
// User clicks on tag area
// Tags become editable with X buttons visible

// User types "javascript," (with comma)
// Tag "javascript" is added
// Now tags are ["react", "tutorial", "javascript"]

// User clicks X on "tutorial"
// Tag is removed
// Now tags are ["react", "javascript"]

// User clicks checkmark
// Tags are saved to database

State Management

Internal state:
  • editable: Whether tags are in edit mode
  • inputValue: Current text input value
  • newTags: Working copy of tags being edited
  • isKeyReleased: Tracks key state for backspace behavior

Validation

  • Tags are trimmed of whitespace
  • Tags are converted to lowercase
  • Duplicate tags are prevented
  • Empty tags are not added

Auto-focus

When entering edit mode, the input is automatically focused, allowing immediate typing.

Build docs developers (and LLMs) love