-
Notifications
You must be signed in to change notification settings - Fork 60
Description
Is your feature request related to a problem? Please describe.
Currently, the UnpicImageProps type omits the style prop (React.CSSProperties), so TypeScript does not allow passing a style prop to the Image component, even though at runtime the image component forwards all other props to the underlying <img /> element. This leads to friction for users who want to pass inline styles, as they either have to use className only or cast style via as any, weakening type safety.
Describe the solution you'd like
Please consider allowing the style prop (style?: React.CSSProperties) in UnpicImageProps so that TypeScript users can pass custom styles to the Image component. This aligns with standard expectations for React image components, and does not break runtime behavior, only improves the developer experience.
If there is a specific reason for omitting style from the type definition, please document it clearly in the README or relevant docs.
Describe alternatives you've considered
- Using only
classNameand external CSS (not always desirable, especially for dynamic styles). - Type casting with
as anyto bypass TS error (not ideal and weakens type safety). - Creating a wrapper component to reintroduce
style(boilerplate, should not be needed for common use cases).
Additional context
Many users expect to be able to use the style prop with React components. Supporting this natively improves the developer experience and aligns with React conventions.