# react-weblineindia-url

> A ReactJS based URL component provides option to add url (like Instagram url, Facebook url, web url, etc.) with validation. The URL value is automatically validated on blur event. You can even disable url field using disable props.

Latest version **1.0.4** (published 2024-10-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-weblineindia-url
pnpm add react-weblineindia-url
yarn add react-weblineindia-url
bun add react-weblineindia-url
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2024-10-21 |
| First published | 2020-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 8 |
| Unpacked size | 270.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | weblineindia |
| Maintainers | partners-wli |
| Keywords | react-weblineindia-url, url-component, react-url-component, react-url-input, reactjs-url, react-url |

## Links

- npm: https://www.npmjs.com/package/react-weblineindia-url
- Repository: https://github.com/weblineindia/ReactJS-URL-Component
- Homepage: https://www.weblineindia.com/software-development-resources.html
- Issues: https://github.com/weblineindia/ReactJS-URL-Component/issues
- npm.io page: https://npm.io/package/react-weblineindia-url

## Dependencies (8)

- [ws](https://npm.io/package/ws.md) ^8.18.0
- [send](https://npm.io/package/send.md) ^1.1.0
- [rollup](https://npm.io/package/rollup.md) ^4.24.0
- [postcss](https://npm.io/package/postcss.md) ^8.4.47
- [webpack](https://npm.io/package/webpack.md) ^5.95.0
- [nth-check](https://npm.io/package/nth-check.md) ^2.1.1
- [body-parser](https://npm.io/package/body-parser.md) ^1.20.3
- [serve-static](https://npm.io/package/serve-static.md) ^1.16.2

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.4 (latest) — 2024-10-21
- 1.0.3 — 2024-04-24
- 1.0.2 — 2024-03-30
- 1.0.0 — 2020-07-23

## README

# ReactJS - URL Component

A ReactJS based URL component provides option to add url (like Instagram url, Facebook url, web url, etc.) with validation. The URL value is automatically validated on blur event. You can even disable url field using disable props.

## Table of contents

- [Browser Support](#browser-support)
- [Demo](#demo)
- [Getting started](#getting-started)
- [Usage](#usage)
- [Available Props](#available-props)
- [Methods](#methods)
- [Want to Contribute?](#want-to-contribute)
- [Collection of Components](#collection-of-components)
- [Changelog](#changelog)
- [License](#license)
- [Keywords](#Keywords)

## Browser Support

| ![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| 83.0 ✔                                                                                   | 77.0 ✔                                                                                      | 13.1.1 ✔                                                                                 | 83.0 ✔                                                                             | 11.9 ✔                                                                                                                       |

## Demo

[![](url.gif)](https://github.com/weblineindia/ReactJS-URL-Component/url.gif)

## Getting started

Install the npm package:

```bash
npm install react-weblineindia-url
#OR
yarn add react-weblineindia-url
```

## Usage

Use the `<react-weblineindia-url>` component:

```js
import React ,{ Component } from 'react';
import UrlComponent from 'react-weblineindia-url'

class Test extends Component {
  constructor(props) {
    super(props);
    this.state = {
      vData: "",
      isInvalidUrl: false
    };
  }

  onChange(event, isError) {
    this.setState({
      vData: event.target.value,
      isInvalidUrl: isError
    });
  }

  onBlur(event, isError) {
    this.setState({
      isInvalidUrl: isError
    });
  }

  render() {
    return (
      <div>
        <Url
          value={this.state.vData}
          onChange={this.onChange.bind(this)}
          onBlur={this.onBlur.bind(this)}
          placeholder="Enter Url"
        />
        {this.state.isInvalidUrl ? (
          <div className="error-text">
            The URL is not valid
          </div>
        ) : ""}
      </div>
    );
  }
}

export default Test;
```

## Available Props

| Prop           | Type    | default       | Description                                    |
| -------------- | ------- | -----------   | ---------------------------------------------- |
| id           | String    |               | ID for the input                               |
| name         | String    |               | Name for the input                             |
| value        | string    |               | Value of the component                         |
| classname    | object    |               | Class to the input                             |
| placeholder  | String    |               | The input field will get this placeholder text |
| hide         | Boolean   | false         | Hide component                                 |
| disabled     | Boolean   | false         | Disable component                              |
| tabindex     | Number    | 0             | Tab index of the component                     |
| maxlength    | Number    | 25            | The input maxlength                            |
| regex        | RegExp    |               | The input regex                                |
| autocomplete | String    | off           | The input of autocomplelete                    |
| type         | String    | text          | Type for the input                             |
| urlttpe      | String    | 'facebook'    | Default url type for component 'facebook' you can pass 'instagram','web','linkedin','other'.based on that regex will set.if you pass other you have to pass regex value which you want |

## Methods

| Name     | Description                                                      |
| -------- | ---------------------------------------------------------------- |
| onFocus    | Gets triggered when the autocomplete input field receives focus. |
| onBlur     | Gets triggered when the autocomplete input field loses focus.    |
| onChange   | Gets triggered when the autocomplete results got changed.        |
| onKeypress | Gets triggered when a key gets pressed.                          |
| onKeyDown  | Gets triggered when a key gets down.                             |
| onKeyUp    | Gets triggered when a key gets up.                               |

## Want to Contribute?

- Created something awesome, made this code better, added some functionality, or whatever (this is the hardest part).
- [Fork it](http://help.github.com/forking/).
- Create new branch to contribute your changes.
- Commit all your changes to your branch.
- Submit a [pull request](http://help.github.com/pull-requests/).

---

## Collection of Components

We have built many other components and free resources for software development in various programming languages. Kindly click here to view our [Free Resources for Software Development](https://www.weblineindia.com/software-development-resources.html)

---

## Changelog

Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).

## License

[MIT](LICENSE)

[mit]: https://github.com/weblineindia/ReactJS-URL-Component/blob/master/LICENSE

## Keywords


react-weblineindia-url, url-component, react-url-component, react-url-input, reactjs-url, react-url

---
_Source: https://npm.io/package/react-weblineindia-url · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
