Kwark. Design System
Open Kwark

Context menu

Right-click or long-press a project, a scene or a card for the same actions its ⋯ button offers, at the pointer.

ComponentsOverlaysIn the app
<div class="kw-ctx" role="menu" aria-label="Actions for Untitled Story">
  <button class="kw-ctx__item" role="menuitem" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3v12M17 8l-5-5-5 5M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/></svg><span>Upload cover</span></button>
  <button class="kw-ctx__item" role="menuitem" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.2a1.8 1.8 0 0 0-1.3 3.1 1.6 1.6 0 0 1-1.5 2.9z"/><circle cx="13.5" cy="6.5" r=".5"/><circle cx="17.5" cy="10.5" r=".5"/><circle cx="6.5" cy="12.5" r=".5"/><circle cx="8.5" cy="7.5" r=".5"/></svg><span>Change illustration</span></button>
  <button class="kw-ctx__item" role="menuitem" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg><span>Open in new tab</span></button>
  <button class="kw-ctx__item" role="menuitem" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21.2 6.8a1 1 0 0 0-4-4L3.8 16.2a2 2 0 0 0-.5.8l-1.3 4.4a.5.5 0 0 0 .6.6l4.4-1.3a2 2 0 0 0 .8-.5z"/></svg><span>Edit project</span></button>
  <button class="kw-ctx__item is-danger" role="menuitem" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg><span>Move to trash</span></button>
</div>

What it is

On Home, right-clicking a project opens the same actions as its ⋯ button: Upload cover, Change illustration, Open in new tab, Edit project, Export project, Move to trash (both read the one actions list in HomeWorkspace). On a desktop it opens at the pointer; under 768px it rises from the foot of the screen as a sheet with a separate Cancel.

When to use

  • Objects people act on often and repeatedly: projects, scenes in the stripboard, cards in the outline.

When not to use

  • As the only way to reach an action. Right-click is invisible; every item must also be on screen, normally behind ⋯ (Menu).
  • Inside the screenplay page, where right-click belongs to the browser’s spelling suggestions.

Writing

Same verbs and the same order as the ⋯ menu. The destructive item comes last and says where things go: Move to trash, not Delete.

Moving it over

ContextMenu.tsx still draws its rows with the older ds-dropdown-item (12px, upper case). The specimen shows the rows it should share with DropdownMenu: 38px, 14px Poppins 500, sentence case. Change the row class when the file is next touched (docs/design-system.md, section 7).

Anatomy

  1. Surface: --k-surface, 1px --k-line, 10px corners, 4px padding, --k-shadow-pop; at least 180px wide.
  2. Row: 38px tall (44px on touch), 4px 12px, 8px gap, 6px corners; icon 14px in --k-text-2, label 14px Poppins 500.
  3. Danger row: --k-danger text, hover tint color-mix(--k-danger 15%, transparent).
  4. Phone: a bottom surface 12px from the edges with the rows, then a separate full-width Cancel.

Tokens

Token Light Dark
--k-surface #ffffff #1a1a1a
--k-raise #f1f5f9 #252525
--k-line #e2e8f0 rgba(255, 255, 255, .1)
--k-text #0f172a #e3e3e3
--k-text-2 #5b6779 #9ca3af
--k-danger #b4382c #e0685c
--k-shadow-pop 0 1px 2px rgba(15, 23, 42, .06), 0 12px 32px rgba(15, 23, 42, .12) 0 2px 6px rgba(0, 0, 0, .2), 0 16px 36px rgba(0, 0, 0, .55)
--k-radius-card 10px
--k-radius-control 6px
--k-fs-body 14px

React

In the Kwark app: import { ContextMenu } from '@/components/ui/ContextMenu'.

<ContextMenu items={actions.map(a => ({ ...a, id: a.label, icon: <a.icon size={14} /> }))}>
  <article className="k-project-row">…</article>
</ContextMenu>
Prop Type Notes
items ContextMenuItem[] { id, label, icon?, onClick, disabled?, danger? }
children ReactNode the thing that is right-clicked; wrapped in display: contents

HTML and CSS

Works anywhere with kwark.css.

<div class="kw-ctx" role="menu" aria-label="Actions for Untitled Story">
  <button class="kw-ctx__item" role="menuitem" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3v12M17 8l-5-5-5 5M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/></svg><span>Upload cover</span></button>
  <button class="kw-ctx__item" role="menuitem" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.2a1.8 1.8 0 0 0-1.3 3.1 1.6 1.6 0 0 1-1.5 2.9z"/><circle cx="13.5" cy="6.5" r=".5"/><circle cx="17.5" cy="10.5" r=".5"/><circle cx="6.5" cy="12.5" r=".5"/><circle cx="8.5" cy="7.5" r=".5"/></svg><span>Change illustration</span></button>
  <button class="kw-ctx__item" role="menuitem" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg><span>Open in new tab</span></button>
  <button class="kw-ctx__item" role="menuitem" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21.2 6.8a1 1 0 0 0-4-4L3.8 16.2a2 2 0 0 0-.5.8l-1.3 4.4a.5.5 0 0 0 .6.6l4.4-1.3a2 2 0 0 0 .8-.5z"/></svg><span>Edit project</span></button>
  <button class="kw-ctx__item is-danger" role="menuitem" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg><span>Move to trash</span></button>
</div>

Keyboard

Key Does
Shift + F10, or the Menu key Must open the same menu for the focused object. Not wired in ContextMenu.tsx yet; until it is, ⋯ is the keyboard path.
Up / Down Moves between enabled items (ContextMenu keeps a focused index).
Enter Runs the item and closes the menu.
Escape Closes the menu.

ARIA

  • role="menu" with role="menuitem" rows; disabled rows carry aria-disabled and are skipped by the arrows.

Rules

  • Must offer every context-menu item somewhere visible as well, normally the ⋯ menu.
  • Must use the same labels and order as the object’s ⋯ menu.
  • Never override right-click on the screenplay page.
  • Always place the destructive item last, in --k-danger, worded as where things go (Move to trash).

AI readiness test

Task. Add a context menu to scene strips on the stripboard.

Give the agent. This page, the Menu page, the strip’s existing ⋯ actions.

Constraint. Keyboard users must reach the same actions.

A reliable answer

  • Reuses the strip’s ⋯ action list verbatim
  • Opens at the pointer on desktop and as a sheet on phones
  • Keeps ⋯ as the keyboard route
  • Puts Remove from day last in danger

Give this Markdown to your coding agent or share its URL.

Open .mdllms.txt
Loading…