跳至正文
Wener Notes

cmdk

约 1 分钟阅读
    • unstyled command menu React component.
    • cmdk -> Command K - ⌘K
TSX
import { Command } from 'cmdk';

const CommandMenu = () => {
  return (
    <Command label='Command Menu'>
      <Command.Input />
      <Command.List>
        {loading && <Command.Loading>Fetching words…</Command.Loading>}
        <Command.Empty>No results found.</Command.Empty>

        <CommandItem value='-' className='hidden' />

        <Command.Group heading='Letters'>
          <Command.Item>a</Command.Item>
          <Command.Item>b</Command.Item>
          <Command.Separator />
          <Command.Item>c</Command.Item>
        </Command.Group>

        <Command.Item>Apple</Command.Item>
      </Command.List>
    </Command>
  );
};

关联信息

反向链接、本文链接的其他页面和外部资料。

参考资料

GitHub1 条
最近更新commit 0892106编辑