Skip to content
loseta

Components / Overlays

Command

A searchable command list for palettes and dialogs.

Status stableInstalls listbox, input-groupWorks with dialog-shell, popover-primitive, popover, card, button, dialog, input
Suggestions
Documents ⌘D
Folders
Messages
Account
Profile ⌘P
Billing ⌘B
Settings ⌘S
<div class="command" style="width: 100%; max-width: 24rem">
  <div class="input-group" role="group" aria-label="Search commands">
    <input class="input" type="text" placeholder="Type a command..." aria-label="Search commands">
    <span data-slot="addon" data-align="inline-start" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg></span>
  </div>
  <div role="listbox" aria-label="Commands">
    <div role="group" aria-labelledby="demo-command-default-suggestions">
      <div data-slot="label" id="demo-command-default-suggestions">Suggestions</div>
      <div role="option">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></svg>
        <span data-slot="text">Documents</span>
        <span data-slot="shortcut">⌘D</span>
      </div>
      <div role="option">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>
        <span data-slot="text">Folders</span>
      </div>
      <div role="option">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
        <span data-slot="text">Messages</span>
      </div>
    </div>
    <div role="separator" aria-hidden="true"></div>
    <div role="group" aria-labelledby="demo-command-default-account">
      <div data-slot="label" id="demo-command-default-account">Account</div>
      <div role="option">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
        <span data-slot="text">Profile</span>
        <span data-slot="shortcut">⌘P</span>
      </div>
      <div role="option">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/></svg>
        <span data-slot="text">Billing</span>
        <span data-slot="shortcut">⌘B</span>
      </div>
      <div role="option">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>
        <span data-slot="text">Settings</span>
        <span data-slot="shortcut">⌘S</span>
      </div>
    </div>
    <div data-slot="empty" hidden>No commands found.</div>
  </div>
</div>

Installation

pnpm dlx loseta add command
npx loseta add command

Examples

Dialog

Command palette

Search for a command to run.

Navigation
Go home ⌘H
Open inbox ⌘I
Open settings ⌘,
Actions
Copy link
Download
Account
Profile ⌘P
Billing ⌘B
Settings ⌘S
<button type="button" class="btn" data-variant="outline">
  Open command
</button>

<dialog class="dialog" id="demo-command" aria-labelledby="command-title" aria-describedby="command-description">
  <div>
    <header>
      <h2 data-slot="title" id="command-title">Command palette</h2>
      <p data-slot="description" id="command-description">Search for a command to run.</p>
    </header>
    <section>
      <div class="command">
        <div class="input-group" role="group" aria-label="Search commands">
          <input class="input" type="text" placeholder="Type a command..." aria-label="Search commands" autofocus>
          <span data-slot="addon" data-align="inline-start" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg></span>
        </div>
        <div role="listbox" aria-label="Commands">
          <div role="group" aria-labelledby="command-group-navigation">
            <div data-slot="label" id="command-group-navigation">Navigation</div>
            <div role="option">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></svg>
              <span data-slot="text">Go home</span>
              <span data-slot="shortcut">⌘H</span>
            </div>
            <div role="option">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
              <span data-slot="text">Open inbox</span>
              <span data-slot="shortcut">⌘I</span>
            </div>
            <div role="option">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>
              <span data-slot="text">Open settings</span>
              <span data-slot="shortcut">⌘,</span>
            </div>
          </div>
          <div role="separator" aria-hidden="true"></div>
          <div role="group" aria-labelledby="command-group-actions">
            <div data-slot="label" id="command-group-actions">Actions</div>
            <div role="option">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></svg>
              <span data-slot="text">Copy link</span>
            </div>
            <div role="option">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>
              <span data-slot="text">Download</span>
            </div>
          </div>
          <div role="separator" aria-hidden="true"></div>
          <div role="group" aria-labelledby="command-group-account">
            <div data-slot="label" id="command-group-account">Account</div>
            <div role="option">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
              <span data-slot="text">Profile</span>
              <span data-slot="shortcut">⌘P</span>
            </div>
            <div role="option">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/></svg>
              <span data-slot="text">Billing</span>
              <span data-slot="shortcut">⌘B</span>
            </div>
            <div role="option">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>
              <span data-slot="text">Settings</span>
              <span data-slot="shortcut">⌘S</span>
            </div>
          </div>
          <div data-slot="empty" hidden>No commands found.</div>
        </div>
      </div>
    </section>
  </div>
</dialog>

Shortcuts

Keyboard shortcuts

Jump to a command without leaving the keyboard.

Navigation
Go home ⌘H
Open inbox ⌘I
Open documents ⌘D
Editing
New file ⌘N
Copy ⌘C
Paste ⌘V
Select all ⌘A
<button type="button" class="btn" data-variant="outline">
  Open shortcuts
</button>

<dialog class="dialog" id="demo-command-shortcuts" aria-labelledby="command-shortcuts-title" aria-describedby="command-shortcuts-description">
  <div>
    <header>
      <h2 data-slot="title" id="command-shortcuts-title">Keyboard shortcuts</h2>
      <p data-slot="description" id="command-shortcuts-description">Jump to a command without leaving the keyboard.</p>
    </header>
    <section>
      <div class="command">
        <div class="input-group" role="group" aria-label="Search shortcuts">
          <input class="input" type="text" placeholder="Search shortcuts..." aria-label="Search shortcuts" autofocus>
          <span data-slot="addon" data-align="inline-start" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg></span>
        </div>
        <div role="listbox" aria-label="Shortcuts">
          <div role="group" aria-labelledby="command-shortcuts-navigation">
            <div data-slot="label" id="command-shortcuts-navigation">Navigation</div>
            <div role="option">
              <span data-slot="text">Go home</span>
              <span data-slot="shortcut">⌘H</span>
            </div>
            <div role="option">
              <span data-slot="text">Open inbox</span>
              <span data-slot="shortcut">⌘I</span>
            </div>
            <div role="option">
              <span data-slot="text">Open documents</span>
              <span data-slot="shortcut">⌘D</span>
            </div>
          </div>
          <div role="separator" aria-hidden="true"></div>
          <div role="group" aria-labelledby="command-shortcuts-editing">
            <div data-slot="label" id="command-shortcuts-editing">Editing</div>
            <div role="option">
              <span data-slot="text">New file</span>
              <span data-slot="shortcut">⌘N</span>
            </div>
            <div role="option">
              <span data-slot="text">Copy</span>
              <span data-slot="shortcut">⌘C</span>
            </div>
            <div role="option">
              <span data-slot="text">Paste</span>
              <span data-slot="shortcut">⌘V</span>
            </div>
            <div role="option">
              <span data-slot="text">Select all</span>
              <span data-slot="shortcut">⌘A</span>
            </div>
          </div>
          <div data-slot="empty" hidden>No shortcuts found.</div>
        </div>
      </div>
    </section>
  </div>
</dialog>

Scrollable

All commands

The list scrolls when the commands exceed its height.

Navigation
Go home⌘H
Open inbox⌘I
Open documents⌘D
Open folders⌘F
Open messages⌘M
Actions
New file⌘N
New folder⇧⌘N
Copy⌘C
Cut⌘X
Paste⌘V
Delete⌫
View
Grid view
List view
Zoom in⌘+
Zoom out⌘-
Account
Profile⌘P
Billing⌘B
Notifications
Help and support
<button type="button" class="btn" data-variant="outline">
  Open all commands
</button>

<dialog class="dialog" id="demo-command-scrollable" aria-labelledby="command-scrollable-title" aria-describedby="command-scrollable-description">
  <div>
    <header>
      <h2 data-slot="title" id="command-scrollable-title">All commands</h2>
      <p data-slot="description" id="command-scrollable-description">The list scrolls when the commands exceed its height.</p>
    </header>
    <section>
      <div class="command">
        <div class="input-group" role="group" aria-label="Search commands">
          <input class="input" type="text" placeholder="Type a command..." aria-label="Search commands" autofocus>
          <span data-slot="addon" data-align="inline-start" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg></span>
        </div>
        <div role="listbox" aria-label="Commands">
          <div role="group" aria-labelledby="command-scrollable-navigation">
            <div data-slot="label" id="command-scrollable-navigation">Navigation</div>
            <div role="option"><span data-slot="text">Go home</span><span data-slot="shortcut">⌘H</span></div>
            <div role="option"><span data-slot="text">Open inbox</span><span data-slot="shortcut">⌘I</span></div>
            <div role="option"><span data-slot="text">Open documents</span><span data-slot="shortcut">⌘D</span></div>
            <div role="option"><span data-slot="text">Open folders</span><span data-slot="shortcut">⌘F</span></div>
            <div role="option"><span data-slot="text">Open messages</span><span data-slot="shortcut">⌘M</span></div>
          </div>
          <div role="separator" aria-hidden="true"></div>
          <div role="group" aria-labelledby="command-scrollable-actions">
            <div data-slot="label" id="command-scrollable-actions">Actions</div>
            <div role="option"><span data-slot="text">New file</span><span data-slot="shortcut">⌘N</span></div>
            <div role="option"><span data-slot="text">New folder</span><span data-slot="shortcut">⇧⌘N</span></div>
            <div role="option"><span data-slot="text">Copy</span><span data-slot="shortcut">⌘C</span></div>
            <div role="option"><span data-slot="text">Cut</span><span data-slot="shortcut">⌘X</span></div>
            <div role="option"><span data-slot="text">Paste</span><span data-slot="shortcut">⌘V</span></div>
            <div role="option"><span data-slot="text">Delete</span><span data-slot="shortcut">⌫</span></div>
          </div>
          <div role="separator" aria-hidden="true"></div>
          <div role="group" aria-labelledby="command-scrollable-view">
            <div data-slot="label" id="command-scrollable-view">View</div>
            <div role="option"><span data-slot="text">Grid view</span></div>
            <div role="option"><span data-slot="text">List view</span></div>
            <div role="option"><span data-slot="text">Zoom in</span><span data-slot="shortcut">⌘+</span></div>
            <div role="option"><span data-slot="text">Zoom out</span><span data-slot="shortcut">⌘-</span></div>
          </div>
          <div role="separator" aria-hidden="true"></div>
          <div role="group" aria-labelledby="command-scrollable-account">
            <div data-slot="label" id="command-scrollable-account">Account</div>
            <div role="option"><span data-slot="text">Profile</span><span data-slot="shortcut">⌘P</span></div>
            <div role="option"><span data-slot="text">Billing</span><span data-slot="shortcut">⌘B</span></div>
            <div role="option"><span data-slot="text">Notifications</span></div>
            <div role="option"><span data-slot="text">Help and support</span></div>
          </div>
          <div data-slot="empty" hidden>No commands found.</div>
        </div>
      </div>
    </section>
  </div>
</dialog>

Card

Quick actions

Search the workspace from this card.

Files
Documents ⌘D
Folders
Account
Profile ⌘P
Settings ⌘S
<div class="card" data-size="sm" style="width: 100%; max-width: 24rem">
  <header>
    <h2 data-slot="title">Quick actions</h2>
    <p data-slot="description">Search the workspace from this card.</p>
  </header>
  <section>
    <div class="command">
      <div class="input-group" role="group" aria-label="Search commands">
        <input class="input" type="text" placeholder="Type a command..." aria-label="Search commands">
        <span data-slot="addon" data-align="inline-start" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg></span>
      </div>
      <div role="listbox" aria-label="Commands">
        <div role="group" aria-labelledby="command-card-files">
          <div data-slot="label" id="command-card-files">Files</div>
          <div role="option">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></svg>
            <span data-slot="text">Documents</span>
            <span data-slot="shortcut">⌘D</span>
          </div>
          <div role="option">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>
            <span data-slot="text">Folders</span>
          </div>
        </div>
        <div role="separator" aria-hidden="true"></div>
        <div role="group" aria-labelledby="command-card-account">
          <div data-slot="label" id="command-card-account">Account</div>
          <div role="option">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
            <span data-slot="text">Profile</span>
            <span data-slot="shortcut">⌘P</span>
          </div>
          <div role="option">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>
            <span data-slot="text">Settings</span>
            <span data-slot="shortcut">⌘S</span>
          </div>
        </div>
        <div data-slot="empty" hidden>No commands found.</div>
      </div>
    </div>
  </section>
</div>

Popover

<div style="display: flex; align-items: flex-start; justify-content: center; min-height: 20rem">
  <div class="popover">
    <button type="button" class="btn" data-variant="outline" aria-haspopup="dialog" aria-expanded="false" aria-controls="demo-command-popover-panel">
      Open command menu
    </button>
    <div data-popover data-side="bottom" data-align="start" id="demo-command-popover-panel" role="dialog" tabindex="-1" aria-labelledby="demo-command-popover-title" aria-hidden="true">
      <header data-slot="header">
        <h3 data-slot="title" id="demo-command-popover-title">Commands</h3>
      </header>
      <div class="command">
        <div class="input-group" role="group" aria-label="Search commands">
          <input class="input" type="text" placeholder="Type a command..." aria-label="Search commands">
          <span data-slot="addon" data-align="inline-start" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg></span>
        </div>
        <div role="listbox" aria-label="Commands">
          <div role="group" aria-labelledby="command-popover-files">
            <div data-slot="label" id="command-popover-files">Files</div>
            <div role="option">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></svg>
              <span data-slot="text">Documents</span>
            </div>
            <div role="option">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>
              <span data-slot="text">Folders</span>
            </div>
          </div>
          <div role="separator" aria-hidden="true"></div>
          <div role="group" aria-labelledby="command-popover-account">
            <div data-slot="label" id="command-popover-account">Account</div>
            <div role="option">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>
              <span data-slot="text">Settings</span>
              <span data-slot="shortcut">⌘S</span>
            </div>
          </div>
          <div data-slot="empty" hidden>No commands found.</div>
        </div>
      </div>
    </div>
  </div>
</div>

Right-to-left

اقتراحات
المستندات ⌘D
المجلدات
الحساب
الملف الشخصي ⌘P
الإعدادات ⌘S
<div dir="rtl" lang="ar" style="width: 100%; max-width: 24rem">
  <div class="command">
    <div class="input-group" role="group" aria-label="ابحث عن الأوامر">
      <input class="input" type="text" placeholder="اكتب أمرًا..." aria-label="ابحث عن الأوامر">
      <span data-slot="addon" data-align="inline-start" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg></span>
    </div>
    <div role="listbox" aria-label="الأوامر">
      <div role="group" aria-labelledby="command-rtl-suggestions">
        <div data-slot="label" id="command-rtl-suggestions">اقتراحات</div>
        <div role="option">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></svg>
          <span data-slot="text">المستندات</span>
          <span data-slot="shortcut">⌘D</span>
        </div>
        <div role="option">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>
          <span data-slot="text">المجلدات</span>
        </div>
      </div>
      <div role="separator" aria-hidden="true"></div>
      <div role="group" aria-labelledby="command-rtl-account">
        <div data-slot="label" id="command-rtl-account">الحساب</div>
        <div role="option">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
          <span data-slot="text">الملف الشخصي</span>
          <span data-slot="shortcut">⌘P</span>
        </div>
        <div role="option">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>
          <span data-slot="text">الإعدادات</span>
          <span data-slot="shortcut">⌘S</span>
        </div>
      </div>
      <div data-slot="empty" hidden>لا توجد نتائج.</div>
    </div>
  </div>
</div>

Accessibility and behavior

  • Content-only: a search field composed with input-group and a listbox of commands. Group labels use [data-slot="label"], dividers use [role="separator"] and the list scrolls at 20rem. Place it inside a dialog, popover or card. Filtering, keyboard navigation and closing on selection are consumer JavaScript. Shortcuts use [data-slot="shortcut"] and stay left-to-right in RTL containers.

Files

components/command.cssbase
styles/nova/command.cssstyle

Install contract

The CLI writes the base file under components/, the visual file for the selected style under styles/<name>/, and any primitive dependency underprimitives/. The generated index.css imports them in the right layer order.

← Back to components

loseta is MIT licensed. Built with native CSS, no runtime. Inspired byshadcn/ui.