Skip to content

Commit

Permalink
fix(): Add data attribute to command item classes. (#6)
Browse files Browse the repository at this point in the history
* fix(): Add data attribute.

* fix(): Fix disabled styles.

---------

Co-authored-by: aidanCQ <[email protected]>
  • Loading branch information
aidanCQ and aidanCQ authored Apr 29, 2024
1 parent 0c6798a commit 5dca136
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/shadcn/ui/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ const CommandItem = React.forwardRef<
<CommandPrimitive.Item
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',
props.disabled ? 'opacity-50 pointer-events-none' : '',
className
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion stories/shadcn/command.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const CommandDemo = () => {
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Settings">
<CommandItem>
<CommandItem disabled >
<PersonIcon className="mr-2 h-4 w-4" />
<span>Profile</span>
<CommandShortcut>⌘P</CommandShortcut>
Expand Down

0 comments on commit 5dca136

Please sign in to comment.