Skip to content

Commit

Permalink
Support onClick for DropdownItem
Browse files Browse the repository at this point in the history
  • Loading branch information
Studio384 committed Aug 22, 2022
1 parent 32eb846 commit 97e2905
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/DropdownItem/DropdownItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export interface DropdownItemProps<T> {
* If we have a href, it's an anchor.
*/
href?: string;
/**
* Optional click handler.
*/
onClick?: () => void;
/**
* Custom classes for the label
*/
Expand All @@ -41,6 +45,7 @@ export function Dropdown<T>({
color,
disabled = false,
children,
onClick,
...props
}: DropdownItemProps<T>) {
const Component = useMemo(() => (as ? as : (href ? 'a' : 'button')) as ElementType, [as, href]);
Expand All @@ -58,6 +63,7 @@ export function Dropdown<T>({
color,
className
)}
onClick={onClick}
href={href}
disabled={disabled}
{...props}
Expand Down

0 comments on commit 97e2905

Please sign in to comment.