Skip to content

feat: input component now support icon libraries#13

Open
AdityaTeltia wants to merge 1 commit intoDksie09:mainfrom
AdityaTeltia:feat/adds-library-support-for-icons
Open

feat: input component now support icon libraries#13
AdityaTeltia wants to merge 1 commit intoDksie09:mainfrom
AdityaTeltia:feat/adds-library-support-for-icons

Conversation

@AdityaTeltia
Copy link

@AdityaTeltia AdityaTeltia commented Aug 27, 2025

Summary

This PR extends the Input component to support icon libraries (e.g., lucide-react, Heroicons, Radix, custom React components) in addition to the existing string-based icons (such as Base64 or SVG paths).

Previously, the icon prop only accepted strings, which limited usage to inline SVGs or image paths. With this change, consumers can now pass React components directly as icons, enabling integration with third-party icon libraries.


Changes

  • Updated InputProps:

    • icon?: string | React.ReactNode
  • Updated render logic in Input:

    • If icon is a string, it renders as <img>.
    • If icon is a ReactNode, it renders directly.
  • Updated Storybook stories:

    • WithIconComponent → shows React component usage (e.g., <Search /> from lucide-react).
    • Added argTypes rule to disable Storybook controls for ReactNode icons while keeping string icons editable.
  • Added Jest tests:

    • Verified string icons render and respond to onIconClick.
    • Verified React component icons render and respond to onIconClick.

Screenshots / Examples

Screenshot 2025-08-27 at 4 18 21 PM

closes #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: Components should support icon libraries

1 participant