goveo / react-international-phone

☎️ International phone input component for React
https://react-international-phone.vercel.app/
MIT License
295 stars 54 forks source link

feat: Allow passing custom component to flags prop #203 #208

Open simonnilsson opened 2 months ago

simonnilsson commented 2 months ago

What has been done

A custom component for rendering flags can now be passed to flags prop instead of list of image URLs enabling support for more use cases. Change is not breaking.

More detailed use case described in #203

Checklist before requesting a review

Example

const CustomFlag = ({
  iso2,
  style,
  className,
}}) => {
  return (
    <img
      src={`/flags/${iso2}.svg`}
      style={{ ...style, width: '24px', height: '24px' }}
      className={className}
    />
  );
};

<PhoneInput flags={CustomFlag} />
vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-international-phone-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2024 0:31am
react-international-phone-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2024 0:31am