Skip to content

Commit 7e1d12a

Browse files
committed
docs: add html renderer usage
1 parent e12c5ed commit 7e1d12a

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,26 @@ export function SelectionExample() {
8383
}
8484
```
8585

86+
## HTML rendering
87+
88+
NitroText can parse HTML string children and inline CSS when you pass `renderer="html"`.
89+
90+
```tsx
91+
import { NitroText } from 'react-native-nitro-text'
92+
93+
export function HtmlExample() {
94+
const html = `
95+
<div>
96+
<h2>Renderer demo</h2>
97+
<p>This text comes from <strong>HTML</strong> with <em>semantic</em> tags.</p>
98+
<p><span style="color: #ff6347; font-weight: bold;">Inline CSS works too.</span></p>
99+
</div>
100+
`
101+
102+
return <NitroText renderer="html">{html}</NitroText>
103+
}
104+
```
105+
86106
## Platform Support
87107

88108
- iOS

0 commit comments

Comments
 (0)