GWAN.DEV


Foundations

Icons

Actions

Buttons

Form Controls

Input

Text Area

Select Dropdown

Filter Dropdown

Checkbox

Radio Button

Switch

File Uploader

Color Picker

Multi Select

Search Input

Slider

OTP Input

Date Picker

Time Picker

Date Range Picker

Data Display

Table

Pagination

Progress Bar

Stat Card

Circular Progress

Navigation

Side Menu

Menu Bar

Tabs

Breadcrumb

Ellipsis

Content & Layout

Card

Divider

Banner

Carousel

Accordion

Timeline

Stepper

List

Overlays

Modal

Drawer

Popover

Command Palette

Dropdown Menu

Context Menu

Indicators

Tags

Chips

Badge

Avatar

Avatar Group

Tooltip

Skeleton

Spinner

Feedback

Snackbar

Alert

Callout

State

Command Palette

Playground
Actions
  1. Interact with the preview to see callbacks fire.
Content
boolean

Whether the palette is showing. Controlled: open it from your own shortcut, close it from onClose.

Default—
ICommandItem[]

Commands as { id, label, onSelect, description?, icon?, group?, shortcut? }. Items with the same group are listed together.

Default—
string

Hint in the search field.

Default"Type a command or search..."
string

Shown when nothing matches the search.

Default"No results found."
Events
() => void

Called on Escape, a click outside, or after a command runs.

Default—
Logged in Actions
Advanced
string

Extra classes on the palette panel.

Default""
Usage
import { Button, useState } from "react";
import {
  Button,
  CommandPalette,
  AddSVG,
  DashboardSVG,
  SettingsSVG,
  SignOutSVG,
} from "gwan-design-system";

const items = [
  {
    id: "new",
    label: "New project",
    icon: <AddSVG />,
    group: "Actions",
    shortcut: ["⌘", "N"],
    onSelect: () => {},
  },
  {
    id: "dash",
    label: "Go to dashboard",
    icon: <DashboardSVG />,
    group: "Navigation",
    onSelect: () => {},
  },
  {
    id: "settings",
    label: "Settings",
    description: "Profile, billing and team",
    icon: <SettingsSVG />,
    group: "Navigation",
    shortcut: ["⌘", ","],
    onSelect: () => {},
  },
  {
    id: "out",
    label: "Sign out",
    icon: <SignOutSVG />,
    group: "Account",
    onSelect: () => {},
  },
];

const Example = () => {
  const [open, setOpen] = useState(false);

  return (
    <>
      <Button label="Open command palette" onClick={() => setOpen(true)} />
      <CommandPalette
        open={open}
        items={items}
        onClose={() => setOpen(false)}
      />
    </>
  );
};