xref: /aosp_15_r20/external/accompanist/web/README.md (revision fa44fe6ae8e729aa3cfe5c03eedbbf98fb44e2c6)
1*fa44fe6aSInna Palant# WebView wrapper for Jetpack Compose
2*fa44fe6aSInna Palant
3*fa44fe6aSInna Palant[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-webview)](https://search.maven.org/search?q=g:com.google.accompanist)
4*fa44fe6aSInna Palant
5*fa44fe6aSInna PalantFor more information, visit the documentation: https://google.github.io/accompanist/web/
6*fa44fe6aSInna Palant
7*fa44fe6aSInna Palant## Basic Usage
8*fa44fe6aSInna Palant
9*fa44fe6aSInna PalantTo implement this wrapper there are two key APIs which are needed: WebView, which provides the layout, and rememberWebViewState(url) which provides some remembered state including the URL to display.
10*fa44fe6aSInna Palant
11*fa44fe6aSInna PalantThe basic usage is as follows:
12*fa44fe6aSInna Palant```kotlin
13*fa44fe6aSInna Palantval state = rememberWebViewState("https://example.com")
14*fa44fe6aSInna Palant
15*fa44fe6aSInna PalantWebView(state)
16*fa44fe6aSInna Palant```
17*fa44fe6aSInna PalantThis will display a WebView in your Compose layout that shows the URL provided.
18*fa44fe6aSInna Palant
19*fa44fe6aSInna Palant## Download
20*fa44fe6aSInna Palant
21*fa44fe6aSInna Palant```groovy
22*fa44fe6aSInna Palantrepositories {
23*fa44fe6aSInna Palant    mavenCentral()
24*fa44fe6aSInna Palant}
25*fa44fe6aSInna Palant
26*fa44fe6aSInna Palantdependencies {
27*fa44fe6aSInna Palant    implementation "com.google.accompanist:accompanist-webview:<version>"
28*fa44fe6aSInna Palant}
29*fa44fe6aSInna Palant```
30*fa44fe6aSInna Palant
31*fa44fe6aSInna PalantSnapshots of the development version are available in [Sonatype's `snapshots` repository][snap]. These are updated on every commit.
32*fa44fe6aSInna Palant
33*fa44fe6aSInna Palant  [snap]: https://oss.sonatype.org/content/repositories/snapshots/com/google/accompanist/accompanist-web/
34