Skip to content
Star

Command palette

Jump anywhere or hand a task to the agent from one box. Free and MIT licensed, as HTML, a typed React component or an Astro component, in three styles with light and dark mode.

$npx designme add command-palette
$npx shadcn@latest add https://designme.dev/r/shadcn/command-palette.json

Need this designed into your product? Book a call

esc
↑↓ move↵ run
01

Install

Add it to your project with the CLI.

HTML, CSS and JS

$npx designme add command-palette

React

$npx designme add command-palette --react

Astro

$npx designme add command-palette --astro

shadcn, React

$npx shadcn@latest add https://designme.dev/r/shadcn/command-palette.json

shadcn, Astro

$npx shadcn@latest add https://designme.dev/r/shadcn/astro/command-palette.json

The CLI copies the source into your project, so you own it and can change anything. Where each version lands, what it needs and the shadcn theme bridge: Installation.

02

About

What it is for and what it does.

A search box with a list of commands under it, grouped by heading, where a person can jump to a page, run an action, or pass what they typed to the agent. As soon as something is typed, the list narrows and a last row, "Ask the agent", sends the text to the agent instead. It gives an agent product one keyboard-first place to start anything.

  • When people need a single shortcut that reaches every page and action in your app.
  • When a typed request that matches no command should still reach the agent.
  • When you want to show keyboard shortcuts next to the commands they trigger.
  • Inside a modal opened by a key such as Cmd K, closed again with Escape.
03

Usage

Import it in React and drive it from your own state, or place it in an Astro page.

React

import { CommandPalette } from '@/components/designme/command-palette/CommandPalette';

React example

The demo above as a React component, 41 lines you can copy.

'use client';
// The animated preview from designme.dev, rebuilt from the React component: an example of driving it from your own state.
import { useRef, useState } from 'react';
import { CommandPalette, type CommandPaletteItem } from './CommandPalette';
import { useStory } from '../lib/useScript';

const COMMANDS: CommandPaletteItem[] = [
  { group: 'Agent', icon: 'spark', label: 'Audit this page for contrast', keys: ['⌘', 'J'], hint: 'WCAG AA', tone: 'purple' },
  { group: 'Agent', icon: 'wand', label: 'Tidy layer names in the selection', hint: '12 layers', tone: 'purple' },
  { group: 'Agent', icon: 'code', label: 'Export tokens as CSS variables', hint: 'tokens.css', tone: 'purple' },
  { group: 'Go to', icon: 'layers', label: 'Pricing v4', keys: ['G', 'P'], hint: 'Page', tone: 'blue' },
  { group: 'Go to', icon: 'figma', label: 'Checkout flow', hint: 'Figma file', tone: 'blue' },
  { group: 'Go to', icon: 'book', label: 'Memory', hint: 'Team notes', tone: 'blue' },
  { group: 'Actions', icon: 'users', label: 'Invite a teammate', hint: 'Acme Labs', tone: 'teal' },
  { group: 'Actions', icon: 'gear', label: 'Agent settings', keys: ['⌘', ','], tone: 'teal' },
  { group: 'Actions', icon: 'palette', label: 'Switch theme', hint: 'Light', tone: 'teal' }
];

/* ---------- Command palette: someone types "tok" and runs the token export, then finds the invite and runs it ---------- */
export default function CommandPaletteDemo() {
  const [query, setQuery] = useState('');
  const ref = useRef<HTMLDivElement>(null);
  // clicking, focusing or typing in it takes over, and what it had typed goes
  useStory(ref, async ({ wait, taken }) => {
    let typing = false;
    taken(() => { if (typing) setQuery(''); });
    const type = async (text: string) => { typing = true; let typed = ''; for (const ch of text) { typed += ch; setQuery(typed); await wait(180); } typing = false; };
    // Enter in the box runs the highlighted row, as a person pressing it would
    const enter = () => ref.current?.querySelector('input')?.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true }));
    await wait(1500);
    await type('tok'); await wait(1000); enter(); await wait(2000);
    setQuery(''); await wait(500);
    await type('invi'); await wait(1000); enter();
  });
  return (
    <div ref={ref} style={{ width: '100%' }}>
      <CommandPalette items={COMMANDS} query={query} onQueryChange={setQuery} />
    </div>
  );
}

Astro

In a page in src/pages. It plays the demo above; change its command-palette.js to show your own data. Attributes like class go on its root element.

---
import CommandPalette from '../components/designme/command-palette/CommandPalette.astro';
---
<CommandPalette />
<CommandPalette data-style="soft" class="my-class" />
04

Props

Everything CommandPalette takes.

PropTypeWhat it does
itemsrequiredCommandPaletteItem[]
querystringWhat is typed in the box. Leave it out to let the box hold its own
defaultQuerystring
onQueryChange(query: string) => void
onRun(item: CommandPaletteItem) => voidCalled when a command runs, by click or Enter
onAsk(query: string) => voidCalled with the typed text when the last row, "Ask the agent", runs
onClose() => voidCalled by Escape when the box is already empty
placeholderstring
statusstringThe quiet text at the end of the footer. Defaults to what ran last
autoFocusbooleanPuts the cursor in the box when it appears
classNamestring
05

Code

The full source, as the CLI installs it.

CommandPalette.tsxReact · 174 lines
'use client';
import { Fragment, useEffect, useId, useRef, useState, type CSSProperties, type KeyboardEvent } from 'react';
import { cx } from '../lib/cx';
import { useControllable, useIsoLayoutEffect, useReducedMotion } from '../lib/hooks';
import { Icon, type IconName } from '../lib/icons';
import { SwapIcon, useGrow, useReflow } from '../lib/motion';
import { useHoverGlide } from '../lib/glide';
import '../designme.css';
import './command-palette.css';

export type CommandTone = 'blue' | 'purple' | 'green' | 'orange' | 'red' | 'yellow' | 'pink' | 'teal';
const TONE: Record<CommandTone, string> = { blue: 'pb', purple: 'pl', green: 'pm', orange: 'pp', red: 'pr', yellow: 'py', pink: 'pk', teal: 'pt' };

/** One command in the palette */
export interface CommandPaletteItem {
  /** The group it is listed under, like "Go to" */
  group: string;
  icon: IconName;
  /** What it does, like "Invite a teammate". Typing matches it letter by letter */
  label: string;
  /** Its shortcut, one key per entry, like ['⌘', 'J'] */
  keys?: string[];
  /** A quiet word or two after the label, like "tokens.css". It isn't matched, and gives way first on a narrow palette */
  hint?: string;
  /** The hue of its icon tile, usually one per group. Leave it out for grey */
  tone?: CommandTone;
}

export interface CommandPaletteProps {
  items: CommandPaletteItem[];
  /** What is typed in the box. Leave it out to let the box hold its own */
  query?: string;
  defaultQuery?: string;
  onQueryChange?: (query: string) => void;
  /** Called when a command runs, by click or Enter */
  onRun?: (item: CommandPaletteItem) => void;
  /** Called with the typed text when the last row, "Ask the agent", runs */
  onAsk?: (query: string) => void;
  /** Called by Escape when the box is already empty */
  onClose?: () => void;
  placeholder?: string;
  /** The quiet text at the end of the footer. Defaults to what ran last */
  status?: string;
  /** Puts the cursor in the box when it appears */
  autoFocus?: boolean;
  className?: string;
}

// letters of the query, in order, anywhere in the label
const matches = (label: string, q: string) => {
  const l = label.toLowerCase(); let at = 0;
  for (const ch of q.toLowerCase()) { at = l.indexOf(ch, at); if (at < 0) return false; at++; }
  return true;
};
// what the query matched is marked, as on designme.dev: the query as one run where the label has it together (the first place it
// does), else the letters it matched in order, each at the first place it comes after the one before (as `matches` finds them)
const marked = (label: string, q: string) => {
  if (!q) return label;
  const l = label.toLowerCase(), lq = q.toLowerCase(), at = l.indexOf(lq), on: boolean[] = Array(label.length).fill(false);
  if (at >= 0) on.fill(true, at, at + lq.length);
  else { let j = 0; for (const ch of lq) { j = l.indexOf(ch, j); if (j < 0) return label; on[j++] = true; } }
  const out: { t: string; m: boolean }[] = [];
  for (let i = 0; i < label.length; i++) { const last = out[out.length - 1]; if (last && last.m === on[i]) last.t += label[i]; else out.push({ t: label[i], m: on[i] }); }
  return out.map((p, i) => p.m ? <mark key={i}>{p.t}</mark> : <Fragment key={i}>{p.t}</Fragment>);
};

/** Jump anywhere or hand a task to the agent from one box. Type to filter, arrows to move, Enter to run, Escape to clear.
    Each command has a tile in its hue and a quiet hint; a command that runs spins its tile for a beat. */
export function CommandPalette({ items, query, defaultQuery = '', onQueryChange, onRun, onAsk, onClose, placeholder = 'Search or ask the agent', status, autoFocus, className }: CommandPaletteProps) {
  const [q, setQ] = useControllable(query, defaultQuery, onQueryChange);
  const v = q.trim();
  const shown = items.filter(it => matches(it.label, v));
  const rows = v ? [...shown, null] : shown; // null is the "Ask the agent" row
  // the highlight goes back to the first row whenever the list changes
  const [hi, setHi] = useState({ at: 0, for: v });
  const at = hi.for === v ? Math.min(hi.at, Math.max(0, rows.length - 1)) : 0;
  const [ran, setRan] = useState('');
  // the row that just ran spins its tile for a beat before the footer says what ran
  const [busy, setBusy] = useState<string>();
  const timer = useRef<ReturnType<typeof setTimeout>>(undefined);
  useEffect(() => () => clearTimeout(timer.current), []);
  const list = useRef<HTMLDivElement>(null);
  // a search moves the list (motion pieces): rows that stay glide to their new places, new ones rise in out of a short blur and
  // the ones that went fade where they were
  useReflow(list, '.dm-cpl-i,.dm-cpl-g', { blur: true });
  // the key hints answer the keys: the one pressed (↑, ↓, ↵ or esc) dips for a moment, as a key cap does
  const [kp, setKp] = useState('');
  const kpT = useRef<ReturnType<typeof setTimeout>>(undefined);
  useEffect(() => () => clearTimeout(kpT.current), []);
  const press = (k: string) => { setKp(k); clearTimeout(kpT.current); kpT.current = setTimeout(() => setKp(''), 140); };
  // Studio's one hover: a highlight that glides from row to row (Studio hides the palette's own)
  useHoverGlide(list, '.dm-cpl-i');
  const btns = useRef<(HTMLButtonElement | null)[]>([]);
  const id = useId(), reduce = useReducedMotion();
  const [top, setTop] = useState<{ for: string; px: number }>();
  useIsoLayoutEffect(() => {
    const b = btns.current[at], l = list.current; if (!b || !l) return;
    setTop({ for: v, px: b.offsetTop });
    if (b.offsetTop < l.scrollTop || b.offsetTop + 36 > l.scrollTop + l.clientHeight) l.scrollTo({ top: b.offsetTop - 40, behavior: reduce ? 'auto' : 'smooth' });
  }, [at, v, rows.length, reduce]);

  // while there is more list below, its last row fades out at the edge instead of being cut off by the footer
  const [more, setMore] = useState(false);
  const edge = () => { const l = list.current; if (l) setMore(l.scrollTop + l.clientHeight < l.scrollHeight - 2); };
  useIsoLayoutEffect(edge, [v, rows.length]);

  const move = (d: number) => { if (rows.length) setHi({ at: (at + d + rows.length) % rows.length, for: v }); };
  const run = (i: number) => {
    const row = rows[i];
    if (row === undefined) return;
    if (row) onRun?.(row); else onAsk?.(v);
    const said = row ? 'Ran: ' + row.label : 'Sent to the agent', k = row ? row.group + row.label : '\u0000ask';
    press('Enter'); setBusy(k); clearTimeout(timer.current);
    // (nothing in it scales when pressed, owner 18 Nov)
    timer.current = setTimeout(() => { setBusy(b => b === k ? undefined : b); setRan(said); }, reduce ? 0 : 650);
  };
  const key = (e: KeyboardEvent<HTMLInputElement>) => {
    if (/^(ArrowDown|ArrowUp|Escape)$/.test(e.key)) press(e.key);
    if (e.key === 'ArrowDown') { move(1); e.preventDefault(); }
    else if (e.key === 'ArrowUp') { move(-1); e.preventDefault(); }
    else if (e.key === 'Enter') run(at);
    else if (e.key === 'Escape') { if (q) setQ(''); else onClose?.(); }
  };

  // no room is kept for a longer list (owner, 18 Nov): the box is as tall as what it shows and eases to its new height as a
  // search narrows or widens it (as grow() on the site)
  const [box, inner] = useGrow();
  let group = '';
  return (
    <div data-dm="" ref={box} className={cx('dm-cpl dm-panel dm-growing dm-mx-grow dm-mx-ic', className)}>
      <div ref={inner} className="dm-grow">
      <div className="dm-cpl-in">
        <Icon name="search" />
        {/* the box keeps the focus and points at the highlighted row, so the rows are not tab stops */}
        <input className="dm-cpl-q" placeholder={placeholder} aria-label="Command" spellCheck={false} autoFocus={autoFocus} value={q}
          role="combobox" aria-expanded aria-controls={`${id}-list`} aria-autocomplete="list" aria-activedescendant={rows.length ? `${id}-${at}` : undefined}
          onChange={e => setQ(e.target.value)} onKeyDown={key} />
        <span className={cx('dm-kbd', kp === 'Escape' && 'dm-kp')}>esc</span>
      </div>
      <div className={cx('dm-cpl-list', more && 'dm-more')} role="listbox" id={`${id}-list`} aria-label="Commands" tabIndex={-1} ref={list} onScroll={edge}>
        {/* one highlight, kept as the list changes, so it glides from the row it was on to the one now highlighted */}
        <span className="dm-cpl-hl" style={{ top: top?.px }} />
        {rows.map((row, i) => {
          const head = row ? row.group : 'Ask', k = row ? row.group + row.label : '\u0000ask';
          const g = head !== group ? <div className="dm-cpl-g" data-key={'g:' + head}>{(group = head)}</div> : null;
          const tone = row?.tone ? TONE[row.tone] : undefined;
          return (
            <Fragment key={k}>
              {g}
              <button type="button" ref={el => { btns.current[i] = el; }} className={cx('dm-cpl-i', !row && 'dm-ask', i === at && 'dm-hl')} data-key={k}
                role="option" id={`${id}-${i}`} tabIndex={-1} aria-selected={i === at} onMouseEnter={() => setHi({ at: i, for: v })} onClick={() => run(i)}>
                <span className="dm-ic" style={tone ? { '--dm-tc': `var(--dm-${tone})`, '--dm-tb': `var(--dm-${tone}-bg)` } as CSSProperties : undefined}>
                  <SwapIcon id={busy === k ? 'spin' : 'icon'}>{busy === k ? <span className="dm-spin" aria-hidden="true" /> : <Icon name={row ? row.icon : 'spark'} size="xs" />}</SwapIcon>
                </span>
                <span className="dm-t">{row ? marked(row.label, v) : <>Ask the agent <span className="dm-q">“{v}”</span></>}</span>
                {row?.hint && <span className="dm-cpl-h">{row.hint}</span>}
                {row?.keys && <span className="dm-k">{row.keys.map((k, j) => <span key={j} className="dm-kbd">{k}</span>)}</span>}
                {!row && <span className="dm-kbd dm-ent" aria-hidden="true">↵</span>}
              </button>
            </Fragment>
          );
        })}
      </div>
      {/* what ran last on the left, the keys on the right */}
      <div className="dm-cpl-f dm-muted dm-mx-foot">
        <span className="dm-cpl-st">{(status ?? ran) && <span key={status ?? ran} className="dm-enter"><span className="dm-dot" aria-hidden="true" />{status ?? ran}</span>}</span>
        <span><span className={cx('dm-kbd', kp === 'ArrowUp' && 'dm-kp')}>↑</span><span className={cx('dm-kbd', kp === 'ArrowDown' && 'dm-kp')}>↓</span> move</span>
        <span><span className={cx('dm-kbd', kp === 'Enter' && 'dm-kp')}>↵</span> run</span>
      </div>
      </div>
    </div>
  );
}
command-palette.cssReact · 74 lines
/* Generated from designme.dev by scripts/sync.mjs. Edit the site, then sync. */
/* ---------- Command palette ---------- */
/* one quiet box: each command has a tile in its group's hue and a muted hint after its name; a grey highlight glides to the
   row the arrows are on, and a command that runs turns its tile into a spinner for a beat. Its content sits 16px in from every
   edge (owner, 18 Nov): the group names, the tiles and the footer's words on the left (the glass centred over the tiles, the
   words you type where the rows' words start), esc, the shortcuts and the footer's keys on the right; the rows' highlight reaches 8px out round them. The list is as tall as what it shows, up to six
   rows or so, and the box eases to its new height as a search narrows it (grow(), centred in its stage): no room is kept */
.dm-cpl{display:flex;flex-direction:column;box-shadow:var(--dm-shadow-pop)}
.dm-cpl-in{display:flex;align-items:center;gap:10px;padding:var(--dm-s-3) var(--dm-s-4);border-bottom:1px solid color-mix(in srgb,var(--dm-line) 50%,transparent);color:var(--dm-muted)}
/* the glass sits centred in the rows' 24px tile column and the words you type start where the rows' words do (the input's own
   padding is taken off, so the caret starts on that column) */
.dm-cpl-in>svg:first-child{flex:none;margin-inline:calc((24px - 14px) / 2)}
.dm-cpl-q{flex:1;min-width:0;padding-inline:0;border:0;outline:0;background:transparent;font:inherit;font-size:14px;color:var(--dm-fg);caret-color:var(--dm-accent-fg,var(--dm-fg))}
.dm-cpl-q::placeholder{color:var(--dm-muted)}
/* the line under the search box steps up while it has the focus; a row that takes the focus rings on its own */
.dm-cpl-list{padding:var(--dm-s-2);max-height:236px;overflow-y:auto;position:relative}
/* while there is more list below, its last row fades out at the edge instead of being cut off by the footer */
.dm-cpl-list.dm-more{-webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 32px),transparent);mask-image:linear-gradient(to bottom,#000 calc(100% - 32px),transparent)}
.dm-cpl-g{font-size:11.5px;color:var(--dm-muted);padding:var(--dm-s-2) var(--dm-s-2) var(--dm-s-1)}
.dm-cpl-i{display:flex;align-items:center;gap:10px;width:100%;height:36px;padding:0 var(--dm-s-2);border-radius:calc(10px * var(--dm-rk-m,var(--dm-rk)));font-size:13.5px;text-align:left;color:var(--dm-fg);position:relative;z-index:1}
.dm-cpl-i .dm-ic{width:24px;height:24px;border-radius:calc(7px * var(--dm-rk-m,var(--dm-rk)));display:grid;place-items:center;flex:none;color:var(--dm-tc,var(--dm-fg2));background:var(--dm-tb,var(--dm-chip));transition:background .2s,color .2s,transform .2s var(--dm-ease)}
.dm-cpl-i.dm-hl .dm-ic{transform:scale(1.06)}
.dm-cpl-i .dm-ic .dm-spin{width:11px;height:11px}
/* a label too long for a narrow palette ends in an ellipsis on its one line, so it never spills out of its row; the hint
   gives way first */
.dm-cpl-i .dm-t{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dm-cpl-i .dm-cpl-h{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;color:var(--dm-muted)}
.dm-cpl-i.dm-hl .dm-cpl-h{color:var(--dm-fg2)}
.dm-cpl-i .dm-k{margin-left:auto;display:flex;gap:var(--dm-s-1);flex:none}
.dm-cpl-i mark{background:transparent;color:var(--dm-accent-fg,var(--dm-accent));font-weight:500}
/* the row that hands the text to the agent: an accent tile, the words in quotes, and Enter shown while it is highlighted */
.dm-cpl-i.dm-ask .dm-ic{background:var(--dm-accent);color:var(--dm-on-accent)}
.dm-cpl-i.dm-ask .dm-q{color:var(--dm-fg2)}
.dm-cpl-i .dm-ent{margin-left:auto;opacity:0;transition:opacity .2s}
.dm-cpl-i.dm-hl .dm-ent{opacity:1}
.dm-cpl-hl{position:absolute;left:var(--dm-s-2);right:var(--dm-s-2);height:36px;border-radius:calc(10px * var(--dm-rk-m,var(--dm-rk)));background:var(--dm-row);transition:top .25s var(--dm-ease);z-index:0}
/* its motion (owner's trial, 26 Nov; the core's motion pieces): the highlight glides from row to row on a spring and deepens at
   once under a press; a search moves the rows (reflow()); the key hints dip as their keys are pressed */
.dm-cpl-hl{transition:top var(--dm-t-glide) var(--dm-ease-spring),background-color var(--dm-t-fast) var(--dm-ease)}
.dm-cpl-list:has(.dm-cpl-i:active) .dm-cpl-hl{background:var(--dm-row-press);transition-duration:var(--dm-t-glide),var(--dm-t-press)}
.dm-cpl .dm-kbd{transition:background-color var(--dm-t-fast) var(--dm-ease),translate var(--dm-t-fast) var(--dm-ease)}
.dm-cpl .dm-kbd.dm-kp{background:var(--dm-press);translate:0 1px;transition-duration:var(--dm-t-press)}
@media (prefers-reduced-motion:reduce){.dm-cpl .dm-kbd.dm-kp{translate:none}}
/* the footer: what ran last on the left, the keys on the right (they keep their room; the words give way first) */
.dm-cpl-f{display:flex;gap:14px;align-items:center;padding:var(--dm-s-4);border-top:1px solid color-mix(in srgb,var(--dm-line) 50%,transparent);font-size:11.5px}
.dm-cpl-f>span{flex:none;white-space:nowrap}
/* (the foot's key chips are blocks of their own, as tall as every other key chip) */
.dm-cpl-f .dm-kbd{display:inline-block;margin-right:var(--dm-s-1)}
.dm-cpl-f>.dm-cpl-st{flex:1 1 auto;min-width:0;color:var(--dm-fg2);overflow:hidden;text-overflow:ellipsis}
/* (a footer that lists the keys first keeps what ran at its right end) */
.dm-cpl-f>.dm-cpl-st:last-child{flex:0 1 auto;margin-left:auto}
.dm-cpl-st .dm-dot{color:var(--dm-ok-mark);margin-right:6px;vertical-align:1px}
.dm-cpl-empty{padding:30px 10px;text-align:center;font-size:13px;color:var(--dm-muted)}
:root:not([data-style="soft"],[data-style="studio"]) .dm-cpl-i.dm-hl .dm-ic:not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){transform:none}
/* Studio (owner, 18 Nov): the tiles are one neutral grey with a hairline (the groups' hues carry no meaning here), and the row that
   hands the text to the agent has the ink tile of Studio's primary; the letters a search matches read in the text colour, a step
   heavier. The rows' highlight is concentric with the card (14px, 8px in), nothing grows under the pointer, and the footer is an
   off-white foot strip, edge to edge, its words and keys 16px in */
:root[data-style="studio"] .dm-cpl-i .dm-ic,:root [data-style="studio"] .dm-cpl-i .dm-ic,:root [data-style="studio"].dm-cpl-i .dm-ic{color:var(--dm-fg2);background:var(--dm-chip);box-shadow:inset 0 0 0 1px var(--dm-hair)}
:root[data-style="studio"] .dm-cpl-i.dm-ask .dm-ic,:root [data-style="studio"] .dm-cpl-i.dm-ask .dm-ic,:root [data-style="studio"].dm-cpl-i.dm-ask .dm-ic{color:var(--dm-on-btn);background:linear-gradient(180deg,var(--dm-btn-1),var(--dm-btn-2));box-shadow:none}
:root[data-style="studio"] .dm-cpl-i.dm-hl .dm-ic,:root [data-style="studio"] .dm-cpl-i.dm-hl .dm-ic,:root [data-style="studio"].dm-cpl-i.dm-hl .dm-ic{transform:none}
:root[data-style="studio"] .dm-cpl-i.dm-hl:not(.dm-ask) .dm-ic,:root [data-style="studio"] .dm-cpl-i.dm-hl:not(.dm-ask) .dm-ic,:root [data-style="studio"].dm-cpl-i.dm-hl:not(.dm-ask) .dm-ic{background:var(--dm-surface)}
:root[data-style="studio"] .dm-cpl-i mark,:root [data-style="studio"] .dm-cpl-i mark,:root [data-style="studio"].dm-cpl-i mark{color:var(--dm-fg)}
:root[data-style="studio"] :is(.dm-cpl-i,.dm-cpl-hl),:root [data-style="studio"] :is(.dm-cpl-i,.dm-cpl-hl),:root [data-style="studio"]:is(.dm-cpl-i,.dm-cpl-hl){border-radius:calc(var(--dm-r-card) - 8px)}
:root[data-style="studio"] .dm-cpl-hl,:root [data-style="studio"] .dm-cpl-hl,:root [data-style="studio"].dm-cpl-hl{transition:top var(--dm-t) var(--dm-ease)}
:root[data-style="studio"] .dm-cpl-list.dm-hg .dm-cpl-hl,:root [data-style="studio"] .dm-cpl-list.dm-hg .dm-cpl-hl,:root [data-style="studio"].dm-cpl-list.dm-hg .dm-cpl-hl{display:none}
/* the foot strip is as tall as a strip with a control (44px), so its words sit as far from the card's foot as its sides (16px);
   the list gives up those 10px, so Studio's palette is no taller than Soft's */
:root[data-style="studio"] .dm-cpl-f,:root [data-style="studio"] .dm-cpl-f,:root [data-style="studio"].dm-cpl-f{min-height:calc(28px + 2 * var(--dm-strip-y) + 1px);padding:var(--dm-s-2) var(--dm-s-4);background:var(--dm-strip);border-top-color:var(--dm-line);border-radius:0 0 var(--dm-r-card) var(--dm-r-card)}
:root[data-style="studio"] .dm-cpl-list,:root [data-style="studio"] .dm-cpl-list,:root [data-style="studio"].dm-cpl-list{max-height:226px}
:root[data-style="studio"] .dm-cpl-f .dm-kbd,:root [data-style="studio"] .dm-cpl-f .dm-kbd,:root [data-style="studio"].dm-cpl-f .dm-kbd{background:var(--dm-surface);box-shadow:inset 0 0 0 1px var(--dm-hair)}
:root[data-style="studio"] .dm-cpl .dm-kbd.dm-kp,:root [data-style="studio"] .dm-cpl .dm-kbd.dm-kp,:root [data-style="studio"].dm-cpl .dm-kbd.dm-kp{background:var(--dm-row-on)}
:root[data-style="studio"] .dm-cpl-list.dm-hg:has(.dm-cpl-i:active),:root [data-style="studio"] .dm-cpl-list.dm-hg:has(.dm-cpl-i:active),:root [data-style="studio"].dm-cpl-list.dm-hg:has(.dm-cpl-i:active){--dm-hg-bg:var(--dm-row-press)}
CommandPalette.astroAstro · 28 lines
---
// Generated from designme.dev by scripts/sync.mjs. Edit the site, then sync.
// Command palette: Jump anywhere or hand a task to the agent from one box.
// The markup, CSS and script are designme.dev's own, run by the shared core in ../core, which mounts the component when it scrolls
// into view and plays its demo. To show your own data, change command-palette.js. The markup is kept exactly as it is (is:raw).
import type { HTMLAttributes } from 'astro/types';
import '../core/designme.css';
import './command-palette.css';

export interface Props extends HTMLAttributes<'div'> {
  /** "soft" or "studio" draws it in that style. Leave it out for Blueprint, or for the style set on <html> (data-style="soft" or "studio") */
  'data-style'?: 'soft' | 'studio';
}
const { class: className, ...rest } = Astro.props;
---
<div class:list={['card', className]} data-c="command-palette" {...rest}>
  <div class="stage-in"><Fragment is:raw>
<div class="cpl panel mx-ic mx-grow" data-reveal="pop">
  <div class="cpl-in"><svg class="i s"><use href="#i-search"/></svg><input class="cpl-q" placeholder="Search or ask the agent" aria-label="Command" spellcheck="false"><span class="kbd" data-k="Escape">esc</span></div>
  <div class="cpl-list" role="listbox"></div>
  <div class="cpl-f muted mx-foot"><span class="cpl-st"></span><span><span class="kbd" data-k="ArrowUp">↑</span><span class="kbd" data-k="ArrowDown">↓</span> move</span><span><span class="kbd" data-k="Enter">↵</span> run</span></div>
</div>
  </Fragment></div>
</div>
<script>
  import './command-palette.js';
</script>
command-palette.htmlHTML · 10 lines
<div class="card" data-c="command-palette">
  <div class="stage-in">
    <div class="cpl panel mx-ic mx-grow" data-reveal="pop">
      <div class="cpl-in"><svg class="i s"><use href="#i-search"/></svg><input class="cpl-q" placeholder="Search or ask the agent" aria-label="Command" spellcheck="false"><span class="kbd" data-k="Escape">esc</span></div>
      <div class="cpl-list" role="listbox"></div>
      <div class="cpl-f muted mx-foot"><span class="cpl-st"></span><span><span class="kbd" data-k="ArrowUp">↑</span><span class="kbd" data-k="ArrowDown">↓</span> move</span><span><span class="kbd" data-k="Enter">↵</span> run</span></div>
    </div>
  </div>
</div>
command-palette.cssHTML · 73 lines
/* ---------- Command palette ---------- */
/* one quiet box: each command has a tile in its group's hue and a muted hint after its name; a grey highlight glides to the
   row the arrows are on, and a command that runs turns its tile into a spinner for a beat. Its content sits 16px in from every
   edge (owner, 18 Nov): the group names, the tiles and the footer's words on the left (the glass centred over the tiles, the
   words you type where the rows' words start), esc, the shortcuts and the footer's keys on the right; the rows' highlight reaches 8px out round them. The list is as tall as what it shows, up to six
   rows or so, and the box eases to its new height as a search narrows it (grow(), centred in its stage): no room is kept */
.cpl{display:flex;flex-direction:column;box-shadow:var(--dm-shadow-pop)}
.cpl-in{display:flex;align-items:center;gap:10px;padding:var(--dm-s-3) var(--dm-s-4);border-bottom:1px solid color-mix(in srgb,var(--dm-line) 50%,transparent);color:var(--dm-muted)}
/* the glass sits centred in the rows' 24px tile column and the words you type start where the rows' words do (the input's own
   padding is taken off, so the caret starts on that column) */
.cpl-in>svg:first-child{flex:none;margin-inline:calc((24px - 14px) / 2)}
.cpl-q{flex:1;min-width:0;padding-inline:0;border:0;outline:0;background:transparent;font:inherit;font-size:14px;color:var(--dm-fg);caret-color:var(--dm-accent-fg,var(--dm-fg))}
.cpl-q::placeholder{color:var(--dm-muted)}
/* the line under the search box steps up while it has the focus; a row that takes the focus rings on its own */
.cpl-list{padding:var(--dm-s-2);max-height:236px;overflow-y:auto;position:relative}
/* while there is more list below, its last row fades out at the edge instead of being cut off by the footer */
.cpl-list.more{-webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 32px),transparent);mask-image:linear-gradient(to bottom,#000 calc(100% - 32px),transparent)}
.cpl-g{font-size:11.5px;color:var(--dm-muted);padding:var(--dm-s-2) var(--dm-s-2) var(--dm-s-1)}
.cpl-i{display:flex;align-items:center;gap:10px;width:100%;height:36px;padding:0 var(--dm-s-2);border-radius:calc(10px * var(--dm-rk-m,var(--dm-rk)));font-size:13.5px;text-align:left;color:var(--dm-fg);position:relative;z-index:1}
.cpl-i .ic{width:24px;height:24px;border-radius:calc(7px * var(--dm-rk-m,var(--dm-rk)));display:grid;place-items:center;flex:none;color:var(--dm-tc,var(--dm-fg2));background:var(--dm-tb,var(--dm-chip));transition:background .2s,color .2s,transform .2s var(--dm-ease)}
.cpl-i.hl .ic{transform:scale(1.06)}
.cpl-i .ic .spin{width:11px;height:11px}
/* a label too long for a narrow palette ends in an ellipsis on its one line, so it never spills out of its row; the hint
   gives way first */
.cpl-i .t{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cpl-i .cpl-h{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;color:var(--dm-muted)}
.cpl-i.hl .cpl-h{color:var(--dm-fg2)}
.cpl-i .k{margin-left:auto;display:flex;gap:var(--dm-s-1);flex:none}
.cpl-i mark{background:transparent;color:var(--dm-accent-fg,var(--dm-accent));font-weight:500}
/* the row that hands the text to the agent: an accent tile, the words in quotes, and Enter shown while it is highlighted */
.cpl-i.ask .ic{background:var(--dm-accent);color:var(--dm-on-accent)}
.cpl-i.ask .q{color:var(--dm-fg2)}
.cpl-i .ent{margin-left:auto;opacity:0;transition:opacity .2s}
.cpl-i.hl .ent{opacity:1}
.cpl-hl{position:absolute;left:var(--dm-s-2);right:var(--dm-s-2);height:36px;border-radius:calc(10px * var(--dm-rk-m,var(--dm-rk)));background:var(--dm-row);transition:top .25s var(--dm-ease);z-index:0}
/* its motion (owner's trial, 26 Nov; the core's motion pieces): the highlight glides from row to row on a spring and deepens at
   once under a press; a search moves the rows (reflow()); the key hints dip as their keys are pressed */
.cpl-hl{transition:top var(--dm-t-glide) var(--dm-ease-spring),background-color var(--dm-t-fast) var(--dm-ease)}
.cpl-list:has(.cpl-i:active) .cpl-hl{background:var(--dm-row-press);transition-duration:var(--dm-t-glide),var(--dm-t-press)}
.cpl .kbd{transition:background-color var(--dm-t-fast) var(--dm-ease),translate var(--dm-t-fast) var(--dm-ease)}
.cpl .kbd.kp{background:var(--dm-press);translate:0 1px;transition-duration:var(--dm-t-press)}
@media (prefers-reduced-motion:reduce){.cpl .kbd.kp{translate:none}}
/* the footer: what ran last on the left, the keys on the right (they keep their room; the words give way first) */
.cpl-f{display:flex;gap:14px;align-items:center;padding:var(--dm-s-4);border-top:1px solid color-mix(in srgb,var(--dm-line) 50%,transparent);font-size:11.5px}
.cpl-f>span{flex:none;white-space:nowrap}
/* (the foot's key chips are blocks of their own, as tall as every other key chip) */
.cpl-f .kbd{display:inline-block;margin-right:var(--dm-s-1)}
.cpl-f>.cpl-st{flex:1 1 auto;min-width:0;color:var(--dm-fg2);overflow:hidden;text-overflow:ellipsis}
/* (a footer that lists the keys first keeps what ran at its right end) */
.cpl-f>.cpl-st:last-child{flex:0 1 auto;margin-left:auto}
.cpl-st .dot{color:var(--dm-ok-mark);margin-right:6px;vertical-align:1px}
.cpl-empty{padding:30px 10px;text-align:center;font-size:13px;color:var(--dm-muted)}
:root:not([data-style="soft"],[data-style="studio"]) .cpl-i.hl .ic:not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){transform:none}
/* Studio (owner, 18 Nov): the tiles are one neutral grey with a hairline (the groups' hues carry no meaning here), and the row that
   hands the text to the agent has the ink tile of Studio's primary; the letters a search matches read in the text colour, a step
   heavier. The rows' highlight is concentric with the card (14px, 8px in), nothing grows under the pointer, and the footer is an
   off-white foot strip, edge to edge, its words and keys 16px in */
:root[data-style="studio"] .cpl-i .ic,:root [data-style="studio"] .cpl-i .ic,:root [data-style="studio"].cpl-i .ic{color:var(--dm-fg2);background:var(--dm-chip);box-shadow:inset 0 0 0 1px var(--dm-hair)}
:root[data-style="studio"] .cpl-i.ask .ic,:root [data-style="studio"] .cpl-i.ask .ic,:root [data-style="studio"].cpl-i.ask .ic{color:var(--dm-on-btn);background:linear-gradient(180deg,var(--dm-btn-1),var(--dm-btn-2));box-shadow:none}
:root[data-style="studio"] .cpl-i.hl .ic,:root [data-style="studio"] .cpl-i.hl .ic,:root [data-style="studio"].cpl-i.hl .ic{transform:none}
:root[data-style="studio"] .cpl-i.hl:not(.ask) .ic,:root [data-style="studio"] .cpl-i.hl:not(.ask) .ic,:root [data-style="studio"].cpl-i.hl:not(.ask) .ic{background:var(--dm-surface)}
:root[data-style="studio"] .cpl-i mark,:root [data-style="studio"] .cpl-i mark,:root [data-style="studio"].cpl-i mark{color:var(--dm-fg)}
:root[data-style="studio"] :is(.cpl-i,.cpl-hl),:root [data-style="studio"] :is(.cpl-i,.cpl-hl),:root [data-style="studio"]:is(.cpl-i,.cpl-hl){border-radius:calc(var(--dm-r-card) - 8px)}
:root[data-style="studio"] .cpl-hl,:root [data-style="studio"] .cpl-hl,:root [data-style="studio"].cpl-hl{transition:top var(--dm-t) var(--dm-ease)}
:root[data-style="studio"] .cpl-list.hg .cpl-hl,:root [data-style="studio"] .cpl-list.hg .cpl-hl,:root [data-style="studio"].cpl-list.hg .cpl-hl{display:none}
/* the foot strip is as tall as a strip with a control (44px), so its words sit as far from the card's foot as its sides (16px);
   the list gives up those 10px, so Studio's palette is no taller than Soft's */
:root[data-style="studio"] .cpl-f,:root [data-style="studio"] .cpl-f,:root [data-style="studio"].cpl-f{min-height:calc(28px + 2 * var(--dm-strip-y) + 1px);padding:var(--dm-s-2) var(--dm-s-4);background:var(--dm-strip);border-top-color:var(--dm-line);border-radius:0 0 var(--dm-r-card) var(--dm-r-card)}
:root[data-style="studio"] .cpl-list,:root [data-style="studio"] .cpl-list,:root [data-style="studio"].cpl-list{max-height:226px}
:root[data-style="studio"] .cpl-f .kbd,:root [data-style="studio"] .cpl-f .kbd,:root [data-style="studio"].cpl-f .kbd{background:var(--dm-surface);box-shadow:inset 0 0 0 1px var(--dm-hair)}
:root[data-style="studio"] .cpl .kbd.kp,:root [data-style="studio"] .cpl .kbd.kp,:root [data-style="studio"].cpl .kbd.kp{background:var(--dm-row-on)}
:root[data-style="studio"] .cpl-list.hg:has(.cpl-i:active),:root [data-style="studio"] .cpl-list.hg:has(.cpl-i:active),:root [data-style="studio"].cpl-list.hg:has(.cpl-i:active){--dm-hg-bg:var(--dm-row-press)}
command-palette.jsHTML · 85 lines
// marks what the query matched in a label: the query as one run where the label has it together (the first place it does),
// else the letters it matched in order, each at the first place it comes after the one before (as the filter finds them)
function cplMark(s, v){
  if (!v) return s;
  const lo = s.toLowerCase(), qv = v.toLowerCase(), at = lo.indexOf(qv), on = new Array(s.length).fill(false);
  if (at >= 0) on.fill(true, at, at + qv.length);
  else { let j = 0; for (const ch of qv){ j = lo.indexOf(ch, j); if (j < 0) return s; on[j++] = true; } }
  let h = '', open = false;
  for (let i = 0; i < s.length; i++){ if (on[i] !== open){ h += on[i] ? '<mark>' : '</mark>'; open = on[i]; } h += s[i]; }
  return h + (open ? '</mark>' : '');
}
DM.def('command-palette', (r, c) => {
  r.innerHTML = r.innerHTML.replace('{search}', I('search'));
  // Studio's one hover: a highlight that glides from row to row (hoverGlide)
  c.offs.push(hoverGlide($('.cpl-list', r), '.cpl-i'));
  // [group, icon, label, keys, hint]; each group's tiles take its hue
  const C = [
    ['Agent','spark','Audit this page for contrast',['⌘','J'],'WCAG AA'],
    ['Agent','wand','Tidy layer names in the selection',null,'12 layers'],
    ['Agent','code','Export tokens as CSS variables',null,'tokens.css'],
    ['Go to','layers','Pricing v4',['G','P'],'Page'],
    ['Go to','figma','Checkout flow',null,'Figma file'],
    ['Go to','book','Memory',null,'Team notes'],
    ['Actions','users','Invite a teammate',null,'Acme Labs'],
    ['Actions','gear','Agent settings',['⌘',',']],
    ['Actions','palette','Switch theme',null,'Light']
  ];
  const TONE = { Agent:'pl', 'Go to':'pb', Actions:'pt' };
  const q = $('.cpl-q', r), list = $('.cpl-list', r), st = $('.cpl-st', r);
  list.id = 'cpl-l-' + Math.random().toString(36).slice(2, 7); list.setAttribute('aria-label', 'Commands'); list.tabIndex = -1;
  q.setAttribute('role', 'combobox'); q.setAttribute('aria-expanded', 'true'); q.setAttribute('aria-controls', list.id); q.setAttribute('aria-autocomplete', 'list');
  let items = [], hi = 0, last = C.map(x => x[2]).join('|');
  const esc = s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
  // the highlight is drawn once and kept, so it glides from the row it was on to the one a search leaves highlighted
  const hl = html('<span class="cpl-hl"></span>');
  function paint(){
    const v = q.value.trim(), re = v ? new RegExp('(' + v.split('').map(esc).join(').*?(') + ')', 'i') : null;
    const m = C.filter(x => !re || re.test(x[2]));
    // the list moves only when it changes, not on every letter that keeps it as it is: rows that stay glide to their new
    // places, new ones rise in out of a short blur and the ones that went fade where they were (reflow(), owner's trial of
    // 26 Nov), and the box eases to its new height (grow(), below)
    const key = m.map(x => x[2]).join('|') + (v ? '|ask' : ''), fresh = key !== last && !!items.length; last = key;
    let h = '', g = '';
    m.forEach(x => { if (x[0] !== g){ g = x[0]; h += `<div class="cpl-g" data-k="g:${g}">${g}</div>`; } const label = cplMark(x[2], v), t = TONE[x[0]];
      h += `<button class="cpl-i" role="option" data-t="${x[2]}" data-k="${x[2]}"><span class="ic" style="--dm-tc:var(--dm-${t});--dm-tb:var(--dm-${t}-bg)">${I(x[1],'xs')}</span><span class="t">${label}</span>${x[4] ? `<span class="cpl-h">${x[4]}</span>` : ''}${x[3] ? `<span class="k">${x[3].map(k => `<span class="kbd">${k}</span>`).join('')}</span>` : ''}</button>`; });
    if (v) h += `<div class="cpl-g" data-k="g:Ask">Ask</div><button class="cpl-i ask" data-t="${v.replace(/"/g,'&quot;')}" data-k="ask" data-ask="1"><span class="ic">${I('spark','xs')}</span><span class="t">Ask the agent <span class="q">“${v.replace(/</g,'&lt;')}”</span></span><span class="kbd ent">↵</span></button>`;
    // (the rows are drawn again round the highlight, which stays where it is so its glide carries on)
    const draw = () => { [...list.children].forEach(x => { if (x !== hl) x.remove(); }); if (hl.parentNode !== list) list.prepend(hl); list.insertAdjacentHTML('beforeend', h); };
    if (fresh) reflow(() => $$('.cpl-i,.cpl-g', list), draw, { by:'data-k', root:list, host:list, blur:true }); else draw();
    items = $$('.cpl-i', list); hi = 0;
    // the search box keeps the focus and points at the highlighted row (aria-activedescendant), so the rows are not tab stops
    items.forEach((b, i) => { b.id = list.id + '-' + i; b.tabIndex = -1; b.setAttribute('role', 'option'); b.onmouseenter = () => move(i - hi); b.onclick = () => run(b); });
    if (!items.length) q.removeAttribute('aria-activedescendant'); move(0); edge();
  }
  function move(d){ if (!items.length) return; hi = (hi + d + items.length) % items.length; items.forEach((b, i) => { b.classList.toggle('hl', i === hi); b.setAttribute('aria-selected', i === hi); }); const b = items[hi]; q.setAttribute('aria-activedescendant', b.id); hl.style.top = b.offsetTop + 'px'; if (b.offsetTop < list.scrollTop || b.offsetTop + 36 > list.scrollTop + list.clientHeight) list.scrollTo({ top:b.offsetTop - 40, behavior:REDUCE ? 'auto' : 'smooth' }); }
  const edge = () => list.classList.toggle('more', list.scrollTop + list.clientHeight < list.scrollHeight - 2);
  c.on(list, 'scroll', edge, { passive:true });
  // a command that runs turns its tile into a spinner for a beat, then the footer says what ran
  // (nothing in it scales when pressed, owner 18 Nov)
  // (its glyph and the spinner crossfade, iconSwap(), and the footer's ↵ dips with it)
  function run(b){
    const ic = $('.ic', b), was = ic.innerHTML; key('Enter'); iconSwap(ic, () => { ic.innerHTML = '<span class="spin"></span>'; }, { inner:true });
    setTimeout(() => { if (ic.isConnected) iconSwap(ic, () => { ic.innerHTML = was; }, { inner:true }); swap(st, `<span class="dot"></span>${b.dataset.ask ? 'Sent to the agent' : 'Ran: ' + b.dataset.t}`, true); }, REDUCE ? 0 : 650);
  }
  // the key hints answer the keys: the one pressed (↑, ↓, ↵ or esc) dips for a moment, as a key cap does (owner's trial, 26 Nov)
  function key(k){ const el = $(`.kbd[data-k="${k}"]`, r); if (!el) return; el.classList.add('kp'); clearTimeout(el._kp); el._kp = setTimeout(() => el.classList.remove('kp'), 140); }
  q.oninput = paint;
  q.onkeydown = e => { if (/^(ArrowDown|ArrowUp|Escape)$/.test(e.key)) key(e.key); if (e.key === 'ArrowDown'){ move(1); e.preventDefault(); } else if (e.key === 'ArrowUp'){ move(-1); e.preventDefault(); } else if (e.key === 'Enter' && items[hi]) run(items[hi]); else if (e.key === 'Escape'){ q.value = ''; paint(); } };
  paint();
  // no room is kept for a longer list (owner, 18 Nov): the box is as tall as what it shows and eases to its new height as a
  // search narrows or widens it (grow(), centred in its stage), once its entrance (which scales it) has ended
  const pal = r.classList.contains('cpl') ? r : $('.cpl', r);
  if (pal && r === c.st) Promise.resolve().then(() => Promise.all(pal.getAnimations().map(a => a.finished.catch(() => {})))).then(() => { if (!c.dead && pal.isConnected) c.offs.push(grow(pal)); });
  // the preview's story: someone types "tok" and runs the token export, then looks for "invi" and runs the invite; clicking,
  // focusing or typing in it takes over, and what it had typed goes
  c.story(async s => {
    await s.beat(3);
    await s.type(q, 'tok', { n:.36, each:paint });
    await s.beat(2); run(items[hi]); await s.beat(4);
    await s.type(q, '', { n:.36, each:paint, clear:true }); await s.beat(1);
    await s.type(q, 'invi', { n:.36, each:paint });
    await s.beat(2); run(items[hi]); await s.beat(4);
  });
});
06

Questions

What people ask about it.

How do I send a free-text request to the agent?
Pass onAsk. When the box has text, the last row reads "Ask the agent" with the typed text in quotes, and running it calls onAsk with the trimmed query.
How does the filter match commands?
Each letter of the query must appear in the label in the same order, though not side by side. So "tok" matches "Export tokens as CSS variables".
How do I close the palette with Escape?
Pass onClose. The first Escape clears any text, and the next Escape, on an empty box, calls onClose so you can hide the palette.
Can I focus the input when the palette opens?
Yes. Set autoFocus and the cursor goes into the box when it appears.
07

More in Workspace

Navigation, search, settings, models and automations around the agent.

Tool railA board's tools in one vertical rail: pick one, and its name and key show on hover.
Zoom barUndo, redo, zoom and fit in one floating bar for a canvas.
Run drawerA workflow's run under its canvas: the steps, the log and the data.
Team memoryWhat the agent remembers about your team, editable and removable.
Tools and connectionsThe tools the agent can reach, and how much it may do with each.
Knowledge sourcesThe files, sites and folders the agent knows, and how far each is indexed.
Recurring jobsTasks the agent runs on a schedule, with their last result and a switch.
File explorerProject files, with the ones the agent touched marked.