1.24.0 • Published 2 days ago

@s-ui/react-molecule-phone-input v1.24.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

MoleculePhoneInput

Custom input component to handle phone validation. Gives the user a prefix selector and a phone number input. It also handles the phone number validation and the prefix selection.

Installation

$ npm install @s-ui/react-molecule-phone-input

Usage

Basic usage

Import package and use the component

import MoleculePhoneInput from '@s-ui/react-molecule-phone-input'

const [phone, setPhone] = useState('')
const icon = <IconArrowDown size="16" />
const prefixes = [
  {value: 'ES', label: 'España', countryCode: '+34'},
  {value: 'FR', label: 'Francia', countryCode: '+33'},
  {value: 'PT', label: 'Portugal', countryCode: '+351'},
  {value: 'AD', label: 'Andorra', countryCode: '+376'}
]

return (
  <MoleculePhoneInput
    value={phone}
    onChange={setPhone}
    dropdownIcon={icon}
    prefixes={prefixes}
  />
)

Import the styles (Sass)

@import '~@s-ui/theme/lib/index';
@import '~@s-ui/react-molecule-phone-input/lib/index';
1.24.0

2 days ago

1.23.0

4 months ago

1.22.0

4 months ago

1.21.0

5 months ago

1.20.0

5 months ago

1.15.0

7 months ago

1.14.0

7 months ago

1.13.0

7 months ago

1.12.0

7 months ago

1.19.0

7 months ago

1.18.0

7 months ago

1.17.0

7 months ago

1.16.0

7 months ago

1.9.0

8 months ago

1.8.0

8 months ago

1.7.0

8 months ago

1.6.0

10 months ago

1.5.0

10 months ago

1.11.0

8 months ago

1.10.0

8 months ago

1.4.0

11 months ago

1.3.0

11 months ago

1.2.0

12 months ago

1.1.0

12 months ago