@neynar/ui
Version:
React UI component library built on shadcn/ui and Tailwind CSS
63 lines (53 loc) • 1.43 kB
Markdown
# CommandShortcut
**Type**: component
CommandShortcut - Displays keyboard shortcut for command items Shows the keyboard shortcut associated with a command item, typically displayed on the right side with proper spacing. Supports platform-specific shortcuts and complex key combinations with consistent formatting. The component uses monospace-style formatting with appropriate opacity and spacing to clearly indicate keyboard shortcuts without overwhelming the item content.
## JSX Usage
```jsx
import { CommandShortcut } from '@neynar/ui';
<CommandShortcut
className="value"
>
{/* Your content here */}
</CommandShortcut>
```
## Component Props
### className
- **Type**: `string`
- **Required**: No
- **Description**: Additional CSS classes
### children
- **Type**: `React.ReactNode`
- **Required**: No
- **Description**: No description available
## Examples
### Example 1
```tsx
<CommandItem>
Save File
<CommandShortcut>⌘S</CommandShortcut>
</CommandItem>
```
### Example 2
```tsx
// Multi-key shortcuts
<CommandItem>
Redo
<CommandShortcut>⇧⌘Z</CommandShortcut>
</CommandItem>
```
### Example 3
```tsx
// Platform-specific shortcuts
<CommandItem>
Copy
<CommandShortcut>{isMac ? '⌘C' : 'Ctrl+C'}</CommandShortcut>
</CommandItem>
```
### Example 4
```tsx
// Complex shortcuts with modifiers
<CommandItem>
Open Command Palette
<CommandShortcut>⌘⇧P</CommandShortcut>
</CommandItem>
```