Coder Social home page Coder Social logo

isabella232 / react-linkify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from taghash/react-linkify

0.0 0.0 0.0 299 KB

React component to parse links (urls, emails, etc.) in text into clickable links

Home Page: http://tasti.github.io/react-linkify/

License: MIT License

JavaScript 100.00%

react-linkify's Introduction

React component to parse links (urls, emails, etc.) in text into clickable links

Examples

Live examples are available at http://tasti.github.io/react-linkify/.

Basic

Any link that appears inside the Linkify component will become clickable.

<Linkify>See examples at tasti.github.io/react-linkify/.</Linkify>

Renders to:

See examples at tasti.github.io/react-linkify/.

Advanced

If you're feeling lazy, you can wrap Linkify around anywhere that you want links to become clickable. Even with nested elements, it traverses the tree to find links.

<Linkify>
  <div>react-linkify <span>(tasti.github.io/react-linkify/)</span></div>
    <div>React component to parse links (urls, emails, etc.) in text into clickable links</div>
  See examples at tasti.github.io/react-linkify/.
    <footer>Contact: [email protected]</footer>
</Linkify>

Renders to:

react-linkify (tasti.github.io/react-linkify/) React component to parse links (urls, emails, etc.) in text into clickable links See examples at tasti.github.io/react-linkify/. Contact: [email protected]

Installation

yarn add react-linkify

or

npm install react-linkify --save

Usage

import Linkify from 'react-linkify';

React.render(
  <Linkify>Examples are available at tasti.github.io/react-linkify/.</Linkify>,
  document.body
);

Props

component The type of component to wrap links in. type: any default: 'a'

properties The props that will be added to every matched component. type: object default: {}

NOTE: Use Linkify.MATCH as a value to specify the matched link. The properties prop will always contain {href: Linkify.MATCH, key: 'LINKIFY_KEY_#'} unless overridden.

Customization

You can access to the global Linkify instance used to linkify contents by importing it (import { linkify } from 'react-linkify'). That way you can customize as needed (e.g. disabling existing schemas or adding new ones).

Note that any customization made to that instance will affect every Linkify component you use.

Examples

All kind of links detectable by linkify-it are supported. For examples, visit their website.

react-linkify's People

Contributors

chikathreesix avatar danez avatar fdiskas avatar hschaeidt avatar indeyets avatar ivanalejandro0 avatar maksis avatar raphaelhovsepyan avatar shrikrishnaholla avatar tasti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.