# react-native-html-component

> This allows you to render HTML content within your application. It accepts a string of HTML content as a prop and renders it within a WebView component. This makes it easy to integrate rich HTML content into your React Native application.

Latest version **1.0.4** (published 2025-06-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-html-component
pnpm add react-native-html-component
yarn add react-native-html-component
bun add react-native-html-component
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2025-06-24 |
| First published | 2023-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Caio Teixeira |
| Maintainers | caioedut |
| Keywords | react, react-native, html, render, component |

## Links

- npm: https://www.npmjs.com/package/react-native-html-component
- Repository: https://github.com/caioedut/react-native-html-component
- Homepage: https://github.com/caioedut/react-native-html-component#readme
- Issues: https://github.com/caioedut/react-native-html-component/issues
- npm.io page: https://npm.io/package/react-native-html-component

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2025-06-24
- 1.0.3 — 2024-05-23
- 1.0.2 — 2024-05-23
- 1.0.1 — 2024-05-23
- 1.0.0 — 2024-05-23
- 0.5.8 — 2024-04-02
- 0.5.7 — 2023-12-01
- 0.5.6 — 2023-08-14
- 0.5.5 — 2023-08-07
- 0.5.4 — 2023-07-28
- 0.5.3 — 2023-07-27
- 0.5.1 — 2023-07-27
- 0.5.0 — 2023-07-27
- 0.0.1 — 2023-07-27

## README

# React Native HTML Component

This allows you to render HTML content within your application. It accepts a string of HTML content as a prop and renders it within a WebView component. This makes it easy to integrate rich HTML content into your React Native application.

[![npm version](https://badge.fury.io/js/react-native-html-component.svg)](https://badge.fury.io/js/react-native-html-component)

## Installation

### Expo

```shell
expo install react-native-html-component react-native-webview
```

### Other

```shell
npm install react-native-html-component react-native-webview
# OR
yarn add react-native-html-component react-native-webview
#OR
pnpm add react-native-html-component react-native-webview

```

## Usage

```jsx
import Html from 'react-native-html-component';

export default function App() {
    return (
        <Html html="<p>Hello World!</p>" />
    )
}
```

## Props

### `html`

A string that represents the HTML content to be rendered.

➤ Type: **`string`** <br/>

---

### `allowTextSelection`

An optional boolean that determines whether text selection is allowed.

➤ Type: **`boolean`** <br/>
➤ Default: **`false`** <br/>

---

### `backgroundColor`

An optional string that sets the background color of the root html.

➤ Type: **`string`** <br/>
➤ Default: **`'transparent'`** <br/>

---

### `color`

An optional string that sets the text color of the root html.

➤ Type: **`string`** <br/>
➤ Default: **`'#000000'`** <br/>

---

### `css`

An optional string with pure css that will be injected into the html.

➤ Type: **`string`** <br/>

---

### `delay`

Delay in milliseconds to calculate the element height. It is recommended to use values above 50ms to avoid rendering whitespace.

➤ Type: **`number`** <br/>
➤ Default: **`50`** <br/>

---


### `fontSize`

An optional number that sets the font size of the root html.

➤ Type: **`number`** <br/>
➤ Default: **`16`** <br/>

---

### `style`

An optional StyleProp object that can be used to apply custom styles to the component.

➤ Type: **`StyleProp<ViewStyle>`** <br/>

---

### `onNavigate`

Event fires every time a link is pressed or the url is changed in some way.

The default action opens the url in the browser with `Linking.open(url)`.

Return `true` or `false` to enable or disable the default action.

➤ Type: **`({ url: string }) => boolean`** <br/>

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