VB Project Planning

<story-map>

Horizontal user story map with activity columns and drag-and-drop between columns.

Overview

A web component that renders a horizontal user story map organized by activity columns. Each column contains a <drag-surface> enabling drag-and-drop reorder within a column and transfer between columns. Ideal for sprint planning, backlog grooming, and mapping user activities to deliverable stories.

Attributes

AttributeValuesDefaultDescription
heading-levelnumber—Level (1–6) of the map's top heading: the title if set, else the activity headings. Default: one below the nearest preceding heading on the page, so the outline never skips a level.
srcstring—URL to JSON data with activities and stories. Fetched once per value; a new value replaces the map and aborts an older in-flight request
titlestring—Optional heading above the story map; also names the scroll region
compactboolean—Reduces column widths, padding, and header font sizes for denser layouts

Child Attributes

The <story-map> component expects direct <section> children, each defining an activity column. Story items go inside each section.

Section Attributes (Activity Columns)

Attribute Type Default Description
data-activity string — Activity column identifier. Used in event details and as the internal key.
data-activity-label string Title-cased data-activity Display label for the column header. Falls back to a title-cased version of the activity ID.
data-journey-phase string — Optional link to a <user-journey> phase name for cross-referencing

Item Attributes (Story Cards)

Items inside each section become draggable story cards. Use <article> elements for simple text or <user-story> elements for rich story cards.

Attribute Type Description
draggable boolean Must be set to "true" for drag capability
data-id string Stable identifier for the item, included in event details

Column Structure

Each activity column consists of a sticky header and a drag surface area:

  • Header — displays the activity label in uppercase with a count badge showing the number of stories in that column. The badge updates automatically when items are transferred.
  • Drag surface — a <drag-surface> element that holds the story items. All surfaces share the same group identifier, enabling cross-column transfers.
  • Empty state — when a column has no stories, an italic "No stories yet" placeholder appears. The placeholder is removed when an item is dropped in, and re-added when the last item is dragged out.

The columns sit inside a horizontally scrollable container. Each column has a minimum width of 14rem (11rem in compact mode) and a maximum of 22rem, using flex: 1 0 14rem to fill available space while allowing horizontal scroll when columns exceed the viewport.

Drag Interaction

Items can be reordered within a column and transferred between columns:

  • Reorder — drag an item up or down within the same column. Fires a story-map:reorder event with the old and new indices.
  • Transfer — drag an item from one column and drop it onto another. The count badges on both columns update automatically. Fires a story-map:transfer event.
  • Keyboard — <drag-surface> provides keyboard reorder and cross-surface transfer using its built-in keyboard shortcuts.

JSON Loading

Load the entire story map from a JSON file using the src attribute. The component creates activity columns with <user-story> cards automatically: persona, action, and benefit become <span slot="…"> children, title an <h3 slot="title">, and id / storyId, priority, status, points, and detail (default compact) the matching attributes.

The URL is fetched once and story-map:ready fires after the stories have rendered. Changing src loads the new URL and replaces the map (the request for an older URL is aborted). ready fires once per map; every src load also fires story-map:activities-changed with source: 'src' after it renders. Moving the map in the DOM keeps its stories and does not refetch.

Using with User Stories

For richer story cards, use <user-story> elements as children instead of plain <article> elements. Add the compact attribute on each story for a tighter layout within the columns.

Events

EventDetailDescription
story-map:reorder{ itemId, activity, oldIndex, newIndex }Item reordered within a column
story-map:transfer{ itemId, fromActivity, toActivity, newIndex }Item moved between columns
story-map:ready{ activityCount, storyCount }Fired once after the first render. With src, fired once the JSON has loaded and rendered. Once per element: not re-fired by a later src change (watch activities-changed with source 'src') or when the map is moved in the DOM
story-map:activities-changed{ activities, source: 'property' | 'src' }Fired after each .activities assignment (source 'property') and after each src load has rendered (source 'src')
story-map:upgraded—Fired (in a microtask) each time the map connects and upgrades

JavaScript API

<story-map> follows the HTML-first + JS-first dual-mode contract. Reactive consumers (Montane, Lit, Solid, etc.) should wait for story-map:upgraded before assigning .activities.

PropertyTypeDescription
.activities Activity[] Replace the column structure with an array of activities: { id, label?, journeyPhase?, stories: [{ id, title?, persona?, action?, benefit?, priority?, status?, points? }] }. Stories render as <user-story> cards (or via an optional .renderStory(story) => Element). The columns are rebuilt on assignment. The getter returns the same shape in current DOM order (drags included): assigned stories come back as the records you passed, authored <user-story> cards as their .data, so map.activities = map.activities round-trips.

Accessibility

  • The scroll container uses role="region", labelled by the title attribute (or "Story map" when there is none), and is keyboard-focusable via tabindex="0"
  • Each <drag-surface> has an aria-label describing the activity column (e.g., "Discovery stories")
  • A hidden live region with aria-live="polite" announces transfers between columns using the story's text and the activity labels (e.g. "interview 10 target users moved from Discovery to Design")
  • Keyboard navigation is provided by the underlying <drag-surface> components
  • Each <drag-surface> is exposed as a list of its cards (role="list" / "listitem", kept in step as cards are added and moved). If any card is an element that may not be a list item, such as <article>, that surface is exposed as a labelled role="group" instead and the cards keep their own role. The drag-surface's own move announcements are moved to a hidden status region just after the list, since a list may only contain list items.
  • Column headers are sticky so the activity label remains visible while scrolling down through long columns
  • Respects prefers-reduced-motion: reduce by disabling scroll behavior transitions
  • Uses container-type: inline-size and stacks columns vertically at narrow viewports (<30rem)
  • Print styles remove sticky positioning, enable wrapping columns, and set break-inside: avoid on columns

Related

  • <user-story> — Rich story cards that work as draggable items in columns
  • <impact-effort> — Prioritization matrix for triaging stories
  • <empathy-map> — Empathy maps for user research informing stories
  • <user-journey> — Journey maps linked via data-journey-phase
  • <user-persona> — Persona cards providing context for story owners
  • <drag-surface> — The underlying drag-and-drop primitive used by each column
  • vb-project-planning — the whole package: import '@profpowell/vb-project-planning' registers every component
↑