Skip to content
Vy logo
Components

PhoneNumberInput

PhoneNumberInput lar brukeren fylle ut telefonnummer, inkludert landkode.


Examples

En enkel PhoneNumberInput

<PhoneNumberInput />

En kontrollert PhoneNumberInput

() => {
  const [phoneNumber, setPhoneNumber] = React.useState({ 
    countryCode: '+47', 
    phoneNumber: '81549300'
  });
  return (
    <PhoneNumberInput
      value={phoneNumber}
      onChange={setPhoneNumber}
    />
  );
}

En PhoneNumberInput med FormControl rundt (for feilmeldinger for eksempel):

<FormControl isInvalid={true}>
  <PhoneNumberInput />
  <FormErrorMessage left="6rem">
    Du må fylle ut et telefonnummer
  </FormErrorMessage>
</FormControl>