@neynar/ui
Version:
React UI component library built on shadcn/ui and Tailwind CSS
63 lines (53 loc) • 1.6 kB
Markdown
for command menu Displays when no command items match the current search query. Can contain custom content beyond simple text messages. Automatically shows/hides based on filtered results and announces changes to screen readers. Supports dynamic content using the `useCommandState` hook to access current search term and create contextual empty messages.
```jsx
import { CommandEmpty } from '@neynar/ui';
<CommandEmpty
className="value"
>
{/* Your content here */}
</CommandEmpty>
```
- **Type**: `string`
- **Required**: No
- **Description**: Additional CSS classes
- **Type**: `React.ReactNode`
- **Required**: No
- **Description**: No description available
```tsx
<CommandList>
<CommandEmpty>No commands found.</CommandEmpty>
</CommandList>
```
```tsx
// Custom empty state with icon and helpful text
<CommandEmpty>
<div className="py-6 text-center">
<SearchIcon className="mx-auto h-10 w-10 text-muted-foreground/50" />
<h3 className="mt-2 text-sm font-medium">No results found</h3>
<p className="mt-1 text-sm text-muted-foreground">
Try adjusting your search terms.
</p>
</div>
</CommandEmpty>
```
```tsx
// Dynamic empty message with search term
function DynamicEmpty() {
const search = useCommandState((state) => state.search);
return (
<CommandEmpty>
{search ? `No results found for "${search}".` : 'Start typing to search...'}
</CommandEmpty>
);
}
```
**Type**: component
CommandEmpty - Empty state message