Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/ui/src/components/TextInput/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface TextInputProps extends Omit<ComponentProps<"input">, "ref" | "c
color?: DynamicStringEnumKeysOf<FlowbiteTextInputColors>;
helperText?: ReactNode;
icon?: FC<ComponentProps<"svg">>;
onRightIconClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
rightIcon?: FC<ComponentProps<"svg">>;
shadow?: boolean;
sizing?: DynamicStringEnumKeysOf<FlowbiteTextInputSizes>;
Expand All @@ -60,6 +61,7 @@ export const TextInput = forwardRef<HTMLInputElement, TextInputProps>(
color = "gray",
helperText,
icon: Icon,
onRightIconClick,
rightIcon: RightIcon,
shadow,
sizing = "md",
Expand All @@ -82,7 +84,11 @@ export const TextInput = forwardRef<HTMLInputElement, TextInputProps>(
</div>
)}
{RightIcon && (
<div data-testid="right-icon" className={theme.field.rightIcon.base}>
<div
data-testid="right-icon"
className={`${theme.field.rightIcon.base} ${!onRightIconClick ? "pointer-events-none" : ""}`}
onClick={onRightIconClick}
>
<RightIcon className={theme.field.rightIcon.svg} />
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/TextInput/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const textInputTheme: FlowbiteTextInputTheme = createTheme({
svg: "h-5 w-5 text-gray-500 dark:text-gray-400",
},
rightIcon: {
base: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",
base: "absolute inset-y-0 right-0 flex items-center pr-3",
svg: "h-5 w-5 text-gray-500 dark:text-gray-400",
},
input: {
Expand Down
Loading