darkel-helpers
v1.0.2
Published
A react component to select a country from a list of countries, with flags, names and dial codes
Downloads
1
Readme
darkel-helpers
A collection of helpful utilities and components for React Web Development.
Installation
npm install darkel-helpers
Usage
import React, { useState } from 'react';
import { MobileSelectDialog } from 'darkel-helpers';
const MyComponent = () => {
const [isOpen, setIsOpen] = useState(false);
const [selectedOption, setSelectedOption] =
(useState < Country) | (null > null);
function closeHandler() => {
setOpen(false);
}
function selectedHandler(country: Country|null) {
alert(JSON.stringify(country, null, 2));
}
return (
<div>
<button onClick={() => setIsOpen(true)}>Open Select Dialog</button>
<MobileSelectDialog
open={isOpen}
onClose={closeHandler}
country={null}
onSelect={selectedHandler}
/>
</div>
);
};
export default MyComponent;