xref: /expo/packages/html-elements/README.md (revision 99d2cfbe)
155058f92SEvan Bacon<h1 align="center">@expo/html-elements</h1>
255058f92SEvan Bacon
355058f92SEvan Bacon<img alt="Product: demo" src="https://dev-to-uploads.s3.amazonaws.com/i/xoc3yx7qfqf6e1w6mm2e.png" />
455058f92SEvan Bacon
555058f92SEvan Bacon<p align="center">
655058f92SEvan Bacon  <!-- iOS -->
755058f92SEvan Bacon  <img alt="Supports Expo iOS" longdesc="Supports Expo iOS" src="https://img.shields.io/badge/iOS-4630EB.svg?style=flat-square&logo=APPLE&labelColor=999999&logoColor=fff" />
855058f92SEvan Bacon  <!-- Android -->
955058f92SEvan Bacon  <img alt="Supports Expo Android" longdesc="Supports Expo Android" src="https://img.shields.io/badge/Android-4630EB.svg?style=flat-square&logo=ANDROID&labelColor=A4C639&logoColor=fff" />
1055058f92SEvan Bacon  <!-- Web -->
1155058f92SEvan Bacon  <img alt="Supports Expo Web" longdesc="Supports Expo Web" src="https://img.shields.io/badge/web-4630EB.svg?style=flat-square&logo=GOOGLE-CHROME&labelColor=4285F4&logoColor=fff" />
128b4c59e5SBrent Vatne  <a aria-label="Circle CI" href="https://circleci.com/gh/expo/expo/tree/main">
1355058f92SEvan Bacon    <img alt="Circle CI" src="https://flat.badgen.net/circleci/github/expo/expo?label=Circle%20CI&labelColor=555555&icon=circleci">
1455058f92SEvan Bacon  </a>
1555058f92SEvan Bacon</p>
1655058f92SEvan Bacon
1755058f92SEvan BaconSimple, light-weight, and well tested, universal semantic HTML elements as React components for iOS, Android, web, and desktop apps!
1855058f92SEvan Bacon
1955058f92SEvan BaconWe at Expo recommend using platform agnostic primitives like `View`, `Image`, and `Text` whenever possible but sometimes that's not easy. Some primitives like Tables, and Footers are native to web only and currently have no way of easily accessing. This package aims to solve that while still being an optimal UI package for iOS, and Android.
2055058f92SEvan Bacon
2155058f92SEvan Bacon### What you get
2255058f92SEvan Bacon
2355058f92SEvan Bacon- Using `@expo/html-elements` will optimize your website for SEO and accessibility. Meaning your websites are indexed more accurately and your native apps better accommodate physically impaired users.
2455058f92SEvan Bacon  - This package takes full advantage of [`react-native-web` a11y rules](https://github.com/necolas/react-native-web/blob/master/packages/docs/src/guides/accessibility.stories.mdx) whenever possible.
2555058f92SEvan Bacon  - For example, the `H1` component will render an `<h1 />` on web, a `UILabel` on iOS, and a `TextView` on Android.
2655058f92SEvan Bacon- Every component can accept styles from the `StyleSheet` API.
2755058f92SEvan Bacon- TypeScript works for iOS, Android, and web, no more having to create monkey patches to use `href` on a `Text` element.
2855058f92SEvan Bacon- Every component is tested render **tested universally** for iOS, Android, and Web using the package [`jest-expo-enzyme`](https://www.npmjs.com/package/jest-expo-enzyme). Each element is also **E2E tested** on iOS with Detox, and web with [`jest-expo-puppeteer`](https://www.npmjs.com/package/jest-expo-puppeteer).
2955058f92SEvan Bacon- This package is completely side-effect free!
3055058f92SEvan Bacon
3155058f92SEvan Bacon## Setup
3255058f92SEvan Bacon
3355058f92SEvan BaconInstall:
3455058f92SEvan Bacon
35*99d2cfbeSAman Mittal```
3655058f92SEvan Baconyarn add @expo/html-elements
3755058f92SEvan Bacon```
3855058f92SEvan Bacon
3955058f92SEvan BaconImport and use the package:
4055058f92SEvan Bacon
4155058f92SEvan Bacon```tsx
4255058f92SEvan Baconimport { H1 } from '@expo/html-elements';
4355058f92SEvan Bacon```
4455058f92SEvan Bacon
4555058f92SEvan Bacon# Components
4655058f92SEvan Bacon
4755058f92SEvan BaconHere is a list of all the currently supported elements and the web feature they map to. Not all HTML elements are supported. There are some HTML elements that mostly overlap with some universal modules, you should always try to use the universal modules whenever possible. All supported components are a capitalized variation of the semantic HTML they implement/emulate.
4855058f92SEvan Bacon
4955058f92SEvan Bacon| HTML                                |      `@expo/html-elements`      |
5055058f92SEvan Bacon| ----------------------------------- | :-----------------------------: |
5155058f92SEvan Bacon| [`<a />`][html-a]                   |          [`<A />`](#a)          |
5255058f92SEvan Bacon| [`<article />`][html-article]       |    [`<Article />`](#article)    |
5368675f3eSEvan Bacon| [`<aside />`][html-aside]           |      [`<Aside />`](#aside)      |
5455058f92SEvan Bacon| [`<b />`][html-b]                   |          [`<B />`](#b)          |
5555058f92SEvan Bacon| [`<blockquote />`][html-blockquote] | [`<BlockQuote />`](#blockquote) |
5655058f92SEvan Bacon| [`<br />`][html-br]                 |         [`<BR />`](#br)         |
5755058f92SEvan Bacon| [`<caption />`][html-caption]       |    [`<Caption />`](#caption)    |
5855058f92SEvan Bacon| [`<code />`][html-code]             |       [`<Code />`](#code)       |
5955058f92SEvan Bacon| [`<del />`][html-del]               |        [`<Del />`](#del)        |
60f4a8f663SEvan Bacon| [`<div />`][html-div]               |        [`<Div />`](#div)        |
6155058f92SEvan Bacon| [`<em />`][html-em]                 |         [`<EM />`](#em)         |
6255058f92SEvan Bacon| [`<footer />`][html-footer]         |     [`<Footer />`](#footer)     |
6355058f92SEvan Bacon| [`<h1 />`][html-h1]                 |         [`<H1 />`](#h1)         |
6455058f92SEvan Bacon| [`<h2 />`][html-h2]                 |         [`<H2 />`](#h2)         |
6555058f92SEvan Bacon| [`<h3 />`][html-h3]                 |         [`<H3 />`](#h3)         |
6655058f92SEvan Bacon| [`<h4 />`][html-h4]                 |         [`<H4 />`](#h4)         |
6755058f92SEvan Bacon| [`<h5 />`][html-h5]                 |         [`<H5 />`](#h5)         |
6855058f92SEvan Bacon| [`<h6 />`][html-h6]                 |         [`<H6 />`](#h6)         |
6955058f92SEvan Bacon| [`<header />`][html-header]         |     [`<Header />`](#header)     |
7055058f92SEvan Bacon| [`<hr />`][html-hr]                 |         [`<HR />`](#hr)         |
7155058f92SEvan Bacon| [`<i />`][html-i]                   |          [`<I />`](#i)          |
7255058f92SEvan Bacon| [`<main />`][html-main]             |       [`<Main />`](#main)       |
7355058f92SEvan Bacon| [`<mark />`][html-mark]             |       [`<Mark />`](#mark)       |
7455058f92SEvan Bacon| [`<nav />`][html-nav]               |        [`<Nav />`](#nav)        |
7555058f92SEvan Bacon| [`<p />`][html-p]                   |          [`<P />`](#p)          |
7655058f92SEvan Bacon| [`<pre />`][html-pre]               |        [`<Pre />`](#pre)        |
7755058f92SEvan Bacon| [`<q />`][html-q]                   |          [`<Q />`](#q)          |
7855058f92SEvan Bacon| [`<s />`][html-s]                   |          [`<S />`](#s)          |
7955058f92SEvan Bacon| [`<section />`][html-section]       |    [`<Section />`](#section)    |
80f4a8f663SEvan Bacon| [`<span />`][html-span]             |       [`<Span />`](#span)       |
8155058f92SEvan Bacon| [`<strong />`][html-strong]         |     [`<Strong />`](#strong)     |
8255058f92SEvan Bacon| [`<table />`][html-table]           |      [`<Table />`](#table)      |
8355058f92SEvan Bacon| [`<tbody />`][html-tbody]           |      [`<TBody />`](#tbody)      |
8455058f92SEvan Bacon| [`<td />`][html-td]                 |         [`<TD />`](#td)         |
8555058f92SEvan Bacon| [`<tfoot />`][html-tfoot]           |      [`<TFoot />`](#tfoot)      |
8655058f92SEvan Bacon| [`<th />`][html-th]                 |         [`<TH />`](#th)         |
8755058f92SEvan Bacon| [`<thead />`][html-thead]           |      [`<THead />`](#thead)      |
8855058f92SEvan Bacon| [`<time />`][html-time]             |       [`<Time />`](#time)       |
8955058f92SEvan Bacon| [`<tr />`][html-tr]                 |         [`<TR />`](#tr)         |
9055058f92SEvan Bacon| [`<ul />`][html-ul]                 |         [`<UL />`](#ul)         |
9155058f92SEvan Bacon| [`<li />`][html-li]                 |         [`<LI />`](#li)         |
9255058f92SEvan Bacon| [`<details />`][html-details]       |            ⏱ Pending            |
9355058f92SEvan Bacon| [`<summary />`][html-summary]       |            ⏱ Pending            |
9455058f92SEvan Bacon| [`<progress />`][html-progress]     |            ⏱ Pending            |
9555058f92SEvan Bacon| [`<select />`][html-select]         |            ⏱ Pending            |
9655058f92SEvan Bacon| [`<picture />`][html-picture]       |            ⏱ Pending            |
9755058f92SEvan Bacon| [`<figure />`][html-figure]         |            ⏱ Pending            |
9855058f92SEvan Bacon| [`<figcaption />`][html-figcaption] |            ⏱ Pending            |
9968675f3eSEvan Bacon| [`<form />`][html-form]             |            ⏱ Pending            |
10068675f3eSEvan Bacon| [`<label />`][html-label]           |            ⏱ Pending            |
10155058f92SEvan Bacon
10255058f92SEvan Bacon## External
10355058f92SEvan Bacon
10455058f92SEvan BaconOther features not implemented in this package can be found in different parts of the Expo ecosystem.
10555058f92SEvan Bacon
10655058f92SEvan Bacon| HTML                            |      Universal       |                                                        Package                                                         |
10755058f92SEvan Bacon| ------------------------------- | :------------------: | :--------------------------------------------------------------------------------------------------------------------: |
10855058f92SEvan Bacon| `<audio />`                     |       `Audio`        |                                                 [`expo-av`][ex-audio]                                                  |
10955058f92SEvan Bacon| `<button />`                    |     `<Button />`     |                                                     `react-native`                                                     |
11005da2fa4SJustin Noel| `<input type="text" />`         |   `<TextInput />`    |                                                     `react-native`                                                     |
11155058f92SEvan Bacon| `<input type="file" />`         |    `ImagePicker`     |                                            [`expo-image-picker`][ex-ipick]                                             |
11255058f92SEvan Bacon| `<input type="file" />`         |   `DocumentPicker`   |                                           [`expo-document-picker`][ex-dpick]                                           |
11355058f92SEvan Bacon| `<canvas />`                    |     `<GLView />`     |                                     [`expo-gl`][ex-gl] & [Expo Canvas][ex-canvas]                                      |
11455058f92SEvan Bacon| `<iframe />`                    |    `<WebView />`     | [`<WebView />`][ex-webview]. `@react-native-community/web-view` is not maintained by Expo and doesn't have web support |
115a1065a9cSEvan Bacon| [`<link />`][html-link]         |         None         |              Eject the `index.html` with `npx expo customize` and link resources directly with `<link />`              |
116a1065a9cSEvan Bacon| [`<noscript />`][html-noscript] |         None         |                Eject the `index.html` with `npx expo customize` and use `<noscript />` directly as HTML                |
11755058f92SEvan Bacon| `<div />`                       |      `<View />`      |                                                     `react-native`                                                     |
11855058f92SEvan Bacon| `<img />`                       |     `<Image />`      |                                                     `react-native`                                                     |
11955058f92SEvan Bacon| `<span />`                      |      `<Text />`      |                                                     `react-native`                                                     |
12055058f92SEvan Bacon| `<video />`                     |     `<Video />`      |                                                  [`expo-av`][ex-vid]                                                   |
12155058f92SEvan Bacon| `style="backdrop-filter"`       |    `<BlurView />`    |                                                 [`expo-blur`][ex-blur]                                                 |
12255058f92SEvan Bacon| `style="linear-gradient()"`     | `<LinearGradient />` |                                         [`expo-linear-gradient`][ex-gradient]                                          |
12355058f92SEvan Bacon
124b52e368fSJames Ide[ex-gradient]: https://docs.expo.dev/versions/latest/sdk/linear-gradient/
125b52e368fSJames Ide[ex-webview]: https://docs.expo.dev/versions/latest/sdk/webview/
126b52e368fSJames Ide[ex-audio]: https://docs.expo.dev/versions/latest/sdk/audio
127b52e368fSJames Ide[ex-gl]: https://docs.expo.dev/versions/latest/sdk/gl-view
12855058f92SEvan Bacon[ex-canvas]: https://github.com/expo/expo-2d-context
12955058f92SEvan Bacon[html-noscript]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
13055058f92SEvan Bacon[html-link]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link
131b52e368fSJames Ide[ex-blur]: https://docs.expo.dev/versions/latest/sdk/blur-view/
132b52e368fSJames Ide[ex-vid]: https://docs.expo.dev/versions/latest/sdk/video/
133b52e368fSJames Ide[ex-ipick]: https://docs.expo.dev/versions/latest/sdk/imagepicker/
134b52e368fSJames Ide[ex-dpick]: https://docs.expo.dev/versions/latest/sdk/document-picker/
13555058f92SEvan Bacon
13655058f92SEvan Bacon## Headings
13755058f92SEvan Bacon
13855058f92SEvan BaconHeader elements will use the expected [font size and margins from web](http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css) universally. You can see how the native CSS units (rem, and em) are transformed in [css/units](src/css/units.ts).
13955058f92SEvan Bacon
14055058f92SEvan Bacon```tsx
14155058f92SEvan Baconimport { H1, H2, H3, H4, H5, H6 } from '@expo/html-elements';
14255058f92SEvan Bacon```
14355058f92SEvan Bacon
14455058f92SEvan Bacon### `<H1/>`
14555058f92SEvan Bacon
14655058f92SEvan Bacon```tsx
14755058f92SEvan Baconimport { H1 } from '@expo/html-elements';
14855058f92SEvan Baconexport default () => <H1>Example<H1/>
14955058f92SEvan Bacon```
15055058f92SEvan Bacon
15155058f92SEvan Bacon| Platform | Output                                                 |
15255058f92SEvan Bacon| -------- | ------------------------------------------------------ |
15355058f92SEvan Bacon| Web      | `<h1 aria-level="1" dir="auto" role="heading" />`      |
15455058f92SEvan Bacon| Native   | `<Text accessibilityRole="header" style={[Custom]} />` |
15555058f92SEvan Bacon
15655058f92SEvan Bacon### `<H2/>`
15755058f92SEvan Bacon
15855058f92SEvan Bacon```tsx
15955058f92SEvan Baconimport { H2 } from '@expo/html-elements';
16055058f92SEvan Baconexport default () => <H2>Example<H2/>
16155058f92SEvan Bacon```
16255058f92SEvan Bacon
16355058f92SEvan Bacon| Platform | Output                                                 |
16455058f92SEvan Bacon| -------- | ------------------------------------------------------ |
16555058f92SEvan Bacon| Web      | `<h2 aria-level="2" dir="auto" role="heading" />`      |
16655058f92SEvan Bacon| Native   | `<Text accessibilityRole="header" style={[Custom]} />` |
16755058f92SEvan Bacon
16855058f92SEvan Bacon### `<H3/>`
16955058f92SEvan Bacon
17055058f92SEvan Bacon```tsx
17155058f92SEvan Baconimport { H3 } from '@expo/html-elements';
17255058f92SEvan Baconexport default () => <H3>Example<H3/>
17355058f92SEvan Bacon```
17455058f92SEvan Bacon
17555058f92SEvan Bacon| Platform | Output                                                 |
17655058f92SEvan Bacon| -------- | ------------------------------------------------------ |
17755058f92SEvan Bacon| Web      | `<h3 aria-level="3" dir="auto" role="heading" />`      |
17855058f92SEvan Bacon| Native   | `<Text accessibilityRole="header" style={[Custom]} />` |
17955058f92SEvan Bacon
18055058f92SEvan Bacon### `<H4/>`
18155058f92SEvan Bacon
18255058f92SEvan Bacon```tsx
18355058f92SEvan Baconimport { H4 } from '@expo/html-elements';
18455058f92SEvan Baconexport default () => <H4>Example<H4/>
18555058f92SEvan Bacon```
18655058f92SEvan Bacon
18755058f92SEvan Bacon| Platform | Output                                                 |
18855058f92SEvan Bacon| -------- | ------------------------------------------------------ |
18955058f92SEvan Bacon| Web      | `<h4 aria-level="4" dir="auto" role="heading" />`      |
19055058f92SEvan Bacon| Native   | `<Text accessibilityRole="header" style={[Custom]} />` |
19155058f92SEvan Bacon
19255058f92SEvan Bacon### `<H5/>`
19355058f92SEvan Bacon
19455058f92SEvan Bacon```tsx
19555058f92SEvan Baconimport { H5 } from '@expo/html-elements';
19655058f92SEvan Baconexport default () => <H5>Example<H5/>
19755058f92SEvan Bacon```
19855058f92SEvan Bacon
19955058f92SEvan Bacon| Platform | Output                                                 |
20055058f92SEvan Bacon| -------- | ------------------------------------------------------ |
20155058f92SEvan Bacon| Web      | `<h5 aria-level="5" dir="auto" role="heading" />`      |
20255058f92SEvan Bacon| Native   | `<Text accessibilityRole="header" style={[Custom]} />` |
20355058f92SEvan Bacon
20455058f92SEvan Bacon### `<H6/>`
20555058f92SEvan Bacon
20655058f92SEvan Bacon```tsx
20755058f92SEvan Baconimport { H6 } from '@expo/html-elements';
20855058f92SEvan Baconexport default () => <H6>Example<H6/>
20955058f92SEvan Bacon```
21055058f92SEvan Bacon
21155058f92SEvan Bacon| Platform | Output                                                 |
21255058f92SEvan Bacon| -------- | ------------------------------------------------------ |
21355058f92SEvan Bacon| Web      | `<h6 aria-level="6" dir="auto" role="heading" />`      |
21455058f92SEvan Bacon| Native   | `<Text accessibilityRole="header" style={[Custom]} />` |
21555058f92SEvan Bacon
21655058f92SEvan Bacon## Link
21755058f92SEvan Bacon
21855058f92SEvan Bacon### `<A/>`
21955058f92SEvan Bacon
22055058f92SEvan BaconYou can use the anchor element with href prop to open links. On native this will attempt to use the `Linking` API to open the `href`.
22155058f92SEvan Bacon
22255058f92SEvan Bacon- The CSS style is fully normalized to match `<Text />`
223b52e368fSJames Ide- For pseudo-class effects like hover and focus states check out the package [`react-native-web-hooks`](https://www.npmjs.com/package/react-native-web-hooks) | [tutorial](https://blog.expo.dev/css-pseudo-class-effects-in-expo-for-web-56649f88eb6b)
22455058f92SEvan Bacon
22555058f92SEvan Bacon```tsx
22655058f92SEvan Baconimport { A } from '@expo/html-elements';
22755058f92SEvan Bacon
22855058f92SEvan Baconexport default () => <A href="#" target="_blank" />;
22955058f92SEvan Bacon}
23055058f92SEvan Bacon```
23155058f92SEvan Bacon
23255058f92SEvan Bacon| Platform | Output                                                                          |
23355058f92SEvan Bacon| -------- | ------------------------------------------------------------------------------- |
23455058f92SEvan Bacon| Web      | `<a data-focusable="{true}" dir="auto" href="#" role="link" target="_blank" />` |
23555058f92SEvan Bacon| Native   | `<Text accessibilityRole="link" onPress={[Function]} />`                        |
23655058f92SEvan Bacon
23755058f92SEvan Bacon## Layout
23855058f92SEvan Bacon
23955058f92SEvan BaconYou can use layout elements like Header, Main, Footer, Section, Nav, etc. as a drop-in replacement for `View`s in your existing app.
24055058f92SEvan Bacon
24155058f92SEvan Bacon#### Default Layout style
24255058f92SEvan Bacon
24355058f92SEvan BaconAll layout HTML elements inherit the shared style of `<View />` to accommodate the [Yoga layout engine][yoga] which we use on native for iOS, and Android.
24455058f92SEvan Bacon
24555058f92SEvan Bacon- `display` is always `flex`. This is because [Yoga][yoga] only implements `display: flex`.
24655058f92SEvan Bacon- `flex-direction` is always `column` instead of `row`.
24755058f92SEvan Bacon
24855058f92SEvan Bacon#### Why use Layout elements
24955058f92SEvan Bacon
25055058f92SEvan BaconConsider the following: in your app you have a basic element at the top which wraps the buttons and title. A screen reader doesn't understand that this is a header, and mostly neither does a web crawler. But if you replace the encasing view with a `<Header />` the following happens:
25155058f92SEvan Bacon
25255058f92SEvan Bacon- **iOS**: `UIView` uses [`UIAccessibilityTraitHeader`](https://developer.apple.com/documentation/uikit/uiaccessibilitytraitheader?language=objc).
25355058f92SEvan Bacon- **Android**: `View` will use the proper [`AccessibilityNodeInfoCompat.CollectionItemInfoCompat`](https://github.com/facebook/react-native/blob/7428271995adf21b2b31b188ed83b785ce1e9189/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java#L370-L372) | [docs](https://developer.android.com/reference/android/support/v4/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat).
25455058f92SEvan Bacon- **web**: render an HTML 5 [`<header />`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header) with the ARIA `role` set to [`"banner"`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Banner_role).
25555058f92SEvan Bacon
25655058f92SEvan BaconSome elements like `Footer` and `Main` have no iOS, or Android enhancements, but they'll still improve web. Using the proper HTML 5 elements will make your layout compliant with the [HTML5 outline algorithm](https://html.spec.whatwg.org/multipage/sections.html#outlines).
25755058f92SEvan Bacon
258f4a8f663SEvan Bacon### `<Div/>`
259f4a8f663SEvan Bacon
260f4a8f663SEvan BaconRenders a `<div />` on web and a `View` with no ARIA set on mobile.
261f4a8f663SEvan Bacon
262f4a8f663SEvan Bacon```tsx
263f4a8f663SEvan Baconimport { Div } from '@expo/html-elements';
264f4a8f663SEvan Bacon
265f4a8f663SEvan Baconexport default () => (
266f4a8f663SEvan Bacon    <Div>
267f4a8f663SEvan Bacon      <P>Some content in the main element</P>
268f4a8f663SEvan Bacon    </Div>
269f4a8f663SEvan Bacon  );
270f4a8f663SEvan Bacon)
271f4a8f663SEvan Bacon```
272f4a8f663SEvan Bacon
273f4a8f663SEvan Bacon| Platform | Output     |
274f4a8f663SEvan Bacon| -------- | ---------- |
275f4a8f663SEvan Bacon| Web      | `<div />`  |
276f4a8f663SEvan Bacon| Native   | `<View />` |
277f4a8f663SEvan Bacon
27855058f92SEvan Bacon### `<Nav/>`
27955058f92SEvan Bacon
28055058f92SEvan Bacon```tsx
28155058f92SEvan Baconimport { Nav } from '@expo/html-elements';
28255058f92SEvan Bacon
28355058f92SEvan Baconexport default () => <Nav />;
28455058f92SEvan Bacon```
28555058f92SEvan Bacon
28655058f92SEvan Bacon| Platform | Output                         |
28755058f92SEvan Bacon| -------- | ------------------------------ |
28855058f92SEvan Bacon| Web      | `<nav style="display:flex" />` |
28955058f92SEvan Bacon| Native   | `<View />`                     |
29055058f92SEvan Bacon
29155058f92SEvan Bacon### `<Header/>`
29255058f92SEvan Bacon
29355058f92SEvan BaconRenders a `<header />` on web with ARIA set to [`banner`][aria-banner] and a `View` with ARIA set to `header` on mobile.
29455058f92SEvan Bacon
29555058f92SEvan Bacon```tsx
29655058f92SEvan Baconimport { Header } from '@expo/html-elements';
29755058f92SEvan Bacon
29855058f92SEvan Baconexport default () => <Header />;
29955058f92SEvan Bacon```
30055058f92SEvan Bacon
30155058f92SEvan Bacon| Platform | Output                                                                                                              |
30255058f92SEvan Bacon| -------- | ------------------------------------------------------------------------------------------------------------------- |
30355058f92SEvan Bacon| Web      | [`<header role="banner" />`][html-header]                                                                           |
30455058f92SEvan Bacon| Native   | `<View />`                                                                                                          |
30555058f92SEvan Bacon| iOS      | `UIView` uses [`UIAccessibilityTraitHeader`][uiatheader].                                                           |
30655058f92SEvan Bacon| Android  | `View` will use the proper [`AccessibilityNodeInfoCompat.CollectionItemInfoCompat`][anicompat] [docs][anicompatdoc] |
30755058f92SEvan Bacon
30855058f92SEvan Bacon[uiatheader]: https://developer.apple.com/documentation/uikit/uiaccessibilitytraitheader?language=objc
30955058f92SEvan Bacon[anicompat]: https://github.com/facebook/react-native/blob/7428271995adf21b2b31b188ed83b785ce1e9189/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java#L370-L372
31055058f92SEvan Bacon[anicompatdoc]: https://developer.android.com/reference/android/support/v4/view/accessibility/AccessibilityNodeInfoCompat.CollectionItemInfoCompat
31155058f92SEvan Bacon
31255058f92SEvan Bacon### `<Main/>`
31355058f92SEvan Bacon
31455058f92SEvan BaconRenders a `<main />` on web with ARIA `role` set to `main` and a `View` with no ARIA set on mobile.
31555058f92SEvan Bacon
31655058f92SEvan Bacon```tsx
31755058f92SEvan Baconimport { Main } from '@expo/html-elements';
31855058f92SEvan Bacon
31955058f92SEvan Baconexport default () => (
32055058f92SEvan Bacon    <Main>
32155058f92SEvan Bacon      <P>Some content in the main element</P>
32255058f92SEvan Bacon    </Main>
32355058f92SEvan Bacon  );
32455058f92SEvan Bacon)
32555058f92SEvan Bacon```
32655058f92SEvan Bacon
32755058f92SEvan Bacon| Platform | Output                                      |
32855058f92SEvan Bacon| -------- | ------------------------------------------- |
32955058f92SEvan Bacon| Web      | `<main role="main" style="display:flex" />` |
33055058f92SEvan Bacon| Native   | `<View />`                                  |
33155058f92SEvan Bacon
33255058f92SEvan Bacon### `<Section/>`
33355058f92SEvan Bacon
33455058f92SEvan BaconRenders a `<section />` on web with ARIA set to `region` and a `View` with ARIA set to `summary` on mobile.
33555058f92SEvan Bacon
33655058f92SEvan Bacon```tsx
33755058f92SEvan Baconimport { Section } from '@expo/html-elements';
33855058f92SEvan Bacon
33955058f92SEvan Baconexport default () => <Section />;
34055058f92SEvan Bacon```
34155058f92SEvan Bacon
34255058f92SEvan Bacon| Platform | Output                                           |
34355058f92SEvan Bacon| -------- | ------------------------------------------------ |
34455058f92SEvan Bacon| Web      | `<section role="region" style="display:flex" />` |
34555058f92SEvan Bacon| Native   | `<View accessibilityRole="summary" />`           |
34655058f92SEvan Bacon
34755058f92SEvan Bacon### `<Article/>`
34855058f92SEvan Bacon
34955058f92SEvan BaconRenders an `<article />` on web and a `View` everywhere else.
35055058f92SEvan Bacon
35155058f92SEvan Bacon```tsx
35255058f92SEvan Baconimport { Article } from '@expo/html-elements';
35355058f92SEvan Bacon
35455058f92SEvan Baconexport default () => <Article />;
35555058f92SEvan Bacon```
35655058f92SEvan Bacon
35755058f92SEvan Bacon| Platform | Output                       |
35868675f3eSEvan Bacon| -------- | ---------------------------- |
35968675f3eSEvan Bacon| Web      | `<article role="article" />` |
36068675f3eSEvan Bacon| Native   | `<View />`                   |
36168675f3eSEvan Bacon
36268675f3eSEvan Bacon### `<Aside/>`
36368675f3eSEvan Bacon
36468675f3eSEvan Bacon```tsx
36568675f3eSEvan Baconimport { Aside } from '@expo/html-elements';
36668675f3eSEvan Bacon
36768675f3eSEvan Baconexport default () => <Aside />;
36868675f3eSEvan Bacon```
36968675f3eSEvan Bacon
37068675f3eSEvan Bacon| Platform | Output                           |
37168675f3eSEvan Bacon| -------- | -------------------------------- |
37268675f3eSEvan Bacon| Web      | `<aside role="complementary" />` |
37355058f92SEvan Bacon| Native   | `<View />`                       |
37455058f92SEvan Bacon
37555058f92SEvan Bacon### `<Footer/>`
37655058f92SEvan Bacon
37755058f92SEvan BaconRenders an `<footer />` on web and a `View` everywhere else.
37855058f92SEvan Bacon
37955058f92SEvan Bacon```tsx
38055058f92SEvan Baconimport { Footer } from '@expo/html-elements';
38155058f92SEvan Bacon
38255058f92SEvan Baconexport default () => <Footer />;
38355058f92SEvan Bacon```
38455058f92SEvan Bacon
38555058f92SEvan Bacon| Platform | Output                          |
38668675f3eSEvan Bacon| -------- | ------------------------------- |
38768675f3eSEvan Bacon| Web      | `<footer role="contentinfo" />` |
38855058f92SEvan Bacon| Native   | `<View />`                      |
38955058f92SEvan Bacon
39055058f92SEvan Bacon## Text
39155058f92SEvan Bacon
39268675f3eSEvan BaconText elements currently use `Text` universally rendering either a `div` or `span` to emulate Yoga style properly.
39355058f92SEvan Bacon
39468675f3eSEvan Bacon- Style is modified to match web.
39537e143d9SEvan Bacon- All font styles are reset (minus `Code`, and `Pre`).
39655058f92SEvan Bacon- All elements accept styles from `StyleSheet` API.
39755058f92SEvan Bacon
39855058f92SEvan Bacon```tsx
39960ea71b8SEvan Baconimport { P, B, S, I, BR, Code } from '@expo/html-elements';
40055058f92SEvan Bacon
40155058f92SEvan Baconexport default () => (
40255058f92SEvan Bacon  <>
40355058f92SEvan Bacon    <P>
40455058f92SEvan Bacon      Hello<B>World (in bold)</B>
40555058f92SEvan Bacon    </P>
40655058f92SEvan Bacon    <S>strike text</S>
40755058f92SEvan Bacon    <BR />
40855058f92SEvan Bacon    <I>Italic</I>
40955058f92SEvan Bacon    <Code>const foo = true</Code>
41055058f92SEvan Bacon  </>
41155058f92SEvan Bacon);
41255058f92SEvan Bacon```
41355058f92SEvan Bacon
41455058f92SEvan Bacon### `<P/>`
41555058f92SEvan Bacon
41655058f92SEvan BaconStandard paragraph element.
41755058f92SEvan Bacon
41855058f92SEvan Bacon| Platform  | Output                                                     |
419a1065a9cSEvan Bacon| --------- | ---------------------------------------------------------- |
42060ea71b8SEvan Bacon| Universal | `<Text style={{ fontSize: 14, marginVertical: '1em' }} />` |
42155058f92SEvan Bacon
42255058f92SEvan Bacon### `<B/>`
42355058f92SEvan Bacon
42455058f92SEvan BaconBold text text.
42555058f92SEvan Bacon
42655058f92SEvan Bacon| Platform  | Output                                    |
42768675f3eSEvan Bacon| --------- | ----------------------------------------- |
42868675f3eSEvan Bacon| Universal | `<Text style={{ fontWeight: 'bold' }} />` |
42955058f92SEvan Bacon
43055058f92SEvan Bacon### `<Strong/>`
43155058f92SEvan Bacon
43255058f92SEvan BaconAlternate bold text.
43355058f92SEvan Bacon
43455058f92SEvan Bacon| Platform  | Output                                    |
43568675f3eSEvan Bacon| --------- | ----------------------------------------- |
43668675f3eSEvan Bacon| Universal | `<Text style={{ fontWeight: 'bold' }} />` |
43755058f92SEvan Bacon
438f4a8f663SEvan Bacon### `<Span/>`
439f4a8f663SEvan Bacon
440f4a8f663SEvan BaconInline text element.
441f4a8f663SEvan Bacon
442f4a8f663SEvan Bacon| Platform  | Output     |
443f4a8f663SEvan Bacon| --------- | ---------- |
444f4a8f663SEvan Bacon| Universal | `<Text />` |
445f4a8f663SEvan Bacon
44655058f92SEvan Bacon### `<S/>`
44755058f92SEvan Bacon
44855058f92SEvan BaconStrike through text.
44955058f92SEvan Bacon
45055058f92SEvan Bacon| Platform  | Output                                                    |
45168675f3eSEvan Bacon| --------- | --------------------------------------------------------- |
45268675f3eSEvan Bacon| Universal | `<Text style={{ textDecorationLine: 'line-through' }} />` |
45355058f92SEvan Bacon
45455058f92SEvan Bacon### `<Del/>`
45555058f92SEvan Bacon
45655058f92SEvan BaconAlternate strike through text.
45755058f92SEvan Bacon
45855058f92SEvan Bacon| Platform  | Output                                                    |
45968675f3eSEvan Bacon| --------- | --------------------------------------------------------- |
46068675f3eSEvan Bacon| Universal | `<Text style={{ textDecorationLine: 'line-through' }} />` |
46155058f92SEvan Bacon
46255058f92SEvan Bacon### `<I/>`
46355058f92SEvan Bacon
46455058f92SEvan BaconItalic text.
46555058f92SEvan Bacon
46655058f92SEvan Bacon| Platform  | Output                                     |
46768675f3eSEvan Bacon| --------- | ------------------------------------------ |
46868675f3eSEvan Bacon| Universal | `<Text style={{ fontStyle: 'italic' }} />` |
46955058f92SEvan Bacon
47055058f92SEvan Bacon### `<EM/>`
47155058f92SEvan Bacon
47255058f92SEvan BaconAlternate italic text.
47355058f92SEvan Bacon
47455058f92SEvan Bacon| Platform  | Output                                     |
47568675f3eSEvan Bacon| --------- | ------------------------------------------ |
47668675f3eSEvan Bacon| Universal | `<Text style={{ fontStyle: 'italic' }} />` |
47755058f92SEvan Bacon
47855058f92SEvan Bacon### `<Code/>`
47955058f92SEvan Bacon
480600afe4bSEvan BaconInline code block with `fontFamily: 'Courier'` on iOS and Web, `fontFamily: 'monospace'` on Android.
48155058f92SEvan Bacon
48255058f92SEvan Bacon| Platform  | Output                      |
48368675f3eSEvan Bacon| --------- | --------------------------- |
48468675f3eSEvan Bacon| Universal | `<Text style={[Custom]} />` |
48555058f92SEvan Bacon
48655058f92SEvan Bacon### `<Pre/>`
48755058f92SEvan Bacon
488600afe4bSEvan BaconRender a preformatted code block with `fontFamily: 'Courier'` on iOS and Web, `fontFamily: 'monospace'` on Android.
48955058f92SEvan Bacon
49055058f92SEvan Bacon```jsx
49155058f92SEvan Bacon<Pre>{`
49255058f92SEvan Baconbody {
49355058f92SEvan Bacon  color: red;
49455058f92SEvan Bacon}
49555058f92SEvan Bacon`}</Pre>
49655058f92SEvan Bacon
49755058f92SEvan Bacon// Or pass views
49855058f92SEvan Bacon
49955058f92SEvan Bacon<Pre>
50055058f92SEvan Bacon  <Code>{`const val = true`}</Code>
50155058f92SEvan Bacon</Pre>
50255058f92SEvan Bacon```
50355058f92SEvan Bacon
50455058f92SEvan Bacon| Platform  | Output                                    |
50568675f3eSEvan Bacon| --------- | ----------------------------------------- |
50668675f3eSEvan Bacon| Universal | `<Text style={[Custom]} />` \| `<View />` |
50755058f92SEvan Bacon
50855058f92SEvan Bacon### `<Mark/>`
50955058f92SEvan Bacon
51055058f92SEvan BaconHighlight text.
51155058f92SEvan Bacon
51255058f92SEvan Bacon| Platform  | Output                                                           |
51368675f3eSEvan Bacon| --------- | ---------------------------------------------------------------- |
51468675f3eSEvan Bacon| Universal | `<Text style={{ backgroundColor: 'yellow', color: 'black' }} />` |
51555058f92SEvan Bacon
51655058f92SEvan Bacon### `<Q/>`
51755058f92SEvan Bacon
51855058f92SEvan BaconQuoted text.
51955058f92SEvan Bacon
52055058f92SEvan Bacon| Platform  | Output                                             |
52168675f3eSEvan Bacon| --------- | -------------------------------------------------- |
52268675f3eSEvan Bacon| Universal | `<Text style={[Custom]}>"{props.children}"</Text>` |
52355058f92SEvan Bacon
52455058f92SEvan Bacon### `<BlockQuote/>`
52555058f92SEvan Bacon
52655058f92SEvan Bacon| Platform  | Output                      |
52768675f3eSEvan Bacon| --------- | --------------------------- |
52868675f3eSEvan Bacon| Universal | `<View style={[Custom]} />` |
52955058f92SEvan Bacon
53055058f92SEvan Bacon### `<Time/>`
53155058f92SEvan Bacon
53255058f92SEvan Bacon- `dateTime` prop is supported on web and stripped on native.
53355058f92SEvan Bacon
53455058f92SEvan Bacon| Platform  | Output                      |
53568675f3eSEvan Bacon| --------- | --------------------------- |
53668675f3eSEvan Bacon| Universal | `<Text style={[Custom]} />` |
53755058f92SEvan Bacon
53855058f92SEvan Bacon## Lists
53955058f92SEvan Bacon
54055058f92SEvan BaconLists can be used to create basic bulleted or numbered lists. You should try and use universal `FlatList` or `SectionList` components for long scrolling lists instead of these.
54155058f92SEvan Bacon
54255058f92SEvan Bacon### `<UL/>`
54355058f92SEvan Bacon
54455058f92SEvan BaconCreate an unordered (bulleted) list `<ul />` on web, and emulates the style with a `<View />` on native.
54555058f92SEvan Bacon
54655058f92SEvan Bacon- [x] Resets font styles everywhere.
54755058f92SEvan Bacon- [ ] Supports i18n by reversing format on iOS and Android
54855058f92SEvan Bacon- [ ] Supports custom bullets
54955058f92SEvan Bacon
55055058f92SEvan Bacon```tsx
55155058f92SEvan Baconimport { UL, LI } from '@expo/html-elements';
55255058f92SEvan Bacon
55355058f92SEvan Baconexport default () => (
55455058f92SEvan Bacon  <UL>
55555058f92SEvan Bacon    <LI>oranges</LI>
55655058f92SEvan Bacon    <LI>apples</LI>
55755058f92SEvan Bacon    <UL>
55855058f92SEvan Bacon      <LI>green</LI>
55955058f92SEvan Bacon      <LI>red</LI>
56055058f92SEvan Bacon    </UL>
56155058f92SEvan Bacon  </UL>
56255058f92SEvan Bacon);
56355058f92SEvan Bacon```
56455058f92SEvan Bacon
56555058f92SEvan Bacon| Platform | Output                      |
56655058f92SEvan Bacon| -------- | --------------------------- |
56755058f92SEvan Bacon| Web      | `<ul />`                    |
56855058f92SEvan Bacon| Native   | `<View style={[Custom]} />` |
56955058f92SEvan Bacon
57055058f92SEvan Bacon### `<LI/>`
57155058f92SEvan Bacon
57255058f92SEvan BaconCreate a standard list item `<li />` on web and a native view on mobile which can render text or views inside it.
57355058f92SEvan Bacon
57455058f92SEvan Bacon| Platform | Output                                                     |
57555058f92SEvan Bacon| -------- | ---------------------------------------------------------- |
57655058f92SEvan Bacon| Web      | `<li />`                                                   |
57755058f92SEvan Bacon| Native   | `<Text style={[Custom]} />` \| `<View style={[Custom]} />` |
57855058f92SEvan Bacon
57955058f92SEvan Bacon## Rules
58055058f92SEvan Bacon
58155058f92SEvan Bacon### `<HR/>`
58255058f92SEvan Bacon
58355058f92SEvan BaconRenders a `<View>` everywhere. Style is modified to match web.
58455058f92SEvan Bacon
58555058f92SEvan Bacon```tsx
58655058f92SEvan Baconimport { HR } from '@expo/html-elements';
58755058f92SEvan Bacon
58855058f92SEvan Baconexport default () => <HR />;
58955058f92SEvan Bacon```
59055058f92SEvan Bacon
59155058f92SEvan Bacon| Platform | Output                      |
59255058f92SEvan Bacon| -------- | --------------------------- |
59355058f92SEvan Bacon| Web      | `<hr />`                    |
59455058f92SEvan Bacon| Native   | `<View style={[Custom]} />` |
59555058f92SEvan Bacon
59655058f92SEvan Bacon### `<BR/>`
59755058f92SEvan Bacon
59855058f92SEvan BaconCreate a line break.
59955058f92SEvan Bacon
60055058f92SEvan Bacon| Platform | Output                                   |
60155058f92SEvan Bacon| -------- | ---------------------------------------- |
60255058f92SEvan Bacon| Web      | `<br />`                                 |
60355058f92SEvan Bacon| Native   | `<View style={{height: 8, width: 0}} />` |
60455058f92SEvan Bacon
60555058f92SEvan Bacon## Tables
60655058f92SEvan Bacon
60755058f92SEvan BaconCreate tables universally.
60855058f92SEvan Bacon
60955058f92SEvan Bacon- Each element renders to the expected type on web.
61055058f92SEvan Bacon- `padding` is removed from all table elements.
61155058f92SEvan Bacon- Text **can only** be rendered in `TH` and `TD` on mobile.
61255058f92SEvan Bacon- `colSpan` and `rowSpan` are currently web-only (PRs welcome).
61355058f92SEvan Bacon
61455058f92SEvan Bacon```tsx
61555058f92SEvan Baconimport { Table, THead, TH, TBody, TFoot, TR, TD, Caption } from '@expo/html-elements';
61655058f92SEvan Baconimport { Text } from 'react-native';
61755058f92SEvan Bacon
61855058f92SEvan Baconexport default () => (
61955058f92SEvan Bacon  <Table>
62055058f92SEvan Bacon    <Caption>Caption</Caption>
62155058f92SEvan Bacon    <THead>
62255058f92SEvan Bacon      <TR>
62355058f92SEvan Bacon        <TH colSpan="2">The table header</TH>
62455058f92SEvan Bacon      </TR>
62555058f92SEvan Bacon    </THead>
62655058f92SEvan Bacon    <TBody>
62755058f92SEvan Bacon      <TR>
62855058f92SEvan Bacon        <TD>The table body</TD>
62955058f92SEvan Bacon        <TD>with two columns</TD>
63055058f92SEvan Bacon      </TR>
63155058f92SEvan Bacon    </TBody>
63255058f92SEvan Bacon    <TFoot>
63355058f92SEvan Bacon      <TR>
63455058f92SEvan Bacon        <TD>
63555058f92SEvan Bacon          <Text>This is the table footer</Text>
63655058f92SEvan Bacon        </TD>
63755058f92SEvan Bacon      </TR>
63855058f92SEvan Bacon    </TFoot>
63955058f92SEvan Bacon  </Table>
64055058f92SEvan Bacon);
64155058f92SEvan Bacon```
64255058f92SEvan Bacon
64355058f92SEvan Bacon#### Table example output web
64455058f92SEvan Bacon
64555058f92SEvan Bacon```html
64655058f92SEvan Bacon<table>
64755058f92SEvan Bacon  <caption>
64855058f92SEvan Bacon    Caption
64955058f92SEvan Bacon  </caption>
65055058f92SEvan Bacon  <thead>
65155058f92SEvan Bacon    <tr>
65255058f92SEvan Bacon      <th colspan="2">The table header</th>
65355058f92SEvan Bacon    </tr>
65455058f92SEvan Bacon  </thead>
65555058f92SEvan Bacon  <tbody>
65655058f92SEvan Bacon    <tr>
65755058f92SEvan Bacon      <td>The table body</td>
65855058f92SEvan Bacon      <td>with two columns</td>
65955058f92SEvan Bacon    </tr>
66055058f92SEvan Bacon  </tbody>
66155058f92SEvan Bacon  <tfoot>
66255058f92SEvan Bacon    <tr>
66355058f92SEvan Bacon      <td><div>The table body</div></td>
66455058f92SEvan Bacon    </tr>
66555058f92SEvan Bacon  </tfoot>
66655058f92SEvan Bacon</table>
66755058f92SEvan Bacon```
66855058f92SEvan Bacon
66955058f92SEvan Bacon### `<Table/>`
67055058f92SEvan Bacon
67155058f92SEvan BaconBase element for creating a Table.
67255058f92SEvan Bacon
67355058f92SEvan Bacon| Platform | Output                      |
67455058f92SEvan Bacon| -------- | --------------------------- |
67555058f92SEvan Bacon| Web      | `<table />`                 |
67655058f92SEvan Bacon| Native   | `<View style={[Custom]} />` |
67755058f92SEvan Bacon
67855058f92SEvan Bacon### `<THead/>`
67955058f92SEvan Bacon
68055058f92SEvan BaconHeader element in a Table.
68155058f92SEvan Bacon
68255058f92SEvan Bacon| Platform | Output                      |
68355058f92SEvan Bacon| -------- | --------------------------- |
68455058f92SEvan Bacon| Web      | `<thead />`                 |
68555058f92SEvan Bacon| Native   | `<View style={[Custom]} />` |
68655058f92SEvan Bacon
68755058f92SEvan Bacon### `<TBody/>`
68855058f92SEvan Bacon
68955058f92SEvan BaconBody element in a Table.
69055058f92SEvan Bacon
69155058f92SEvan Bacon| Platform | Output                      |
69255058f92SEvan Bacon| -------- | --------------------------- |
69355058f92SEvan Bacon| Web      | `<tbody />`                 |
69455058f92SEvan Bacon| Native   | `<View style={[Custom]} />` |
69555058f92SEvan Bacon
69655058f92SEvan Bacon### `<TFoot/>`
69755058f92SEvan Bacon
69855058f92SEvan BaconFooter element in a Table.
69955058f92SEvan Bacon
70055058f92SEvan Bacon| Platform | Output                      |
70155058f92SEvan Bacon| -------- | --------------------------- |
70255058f92SEvan Bacon| Web      | `<tfoot />`                 |
70355058f92SEvan Bacon| Native   | `<View style={[Custom]} />` |
70455058f92SEvan Bacon
70555058f92SEvan Bacon### `<TH/>`
70655058f92SEvan Bacon
70755058f92SEvan BaconUsed to display text in the Header.
70855058f92SEvan Bacon
70955058f92SEvan Bacon- `colSpan` and `rowSpan` are currently web-only.
71055058f92SEvan Bacon
71155058f92SEvan Bacon| Platform | Output                      |
71255058f92SEvan Bacon| -------- | --------------------------- |
71355058f92SEvan Bacon| Web      | `<th />`                    |
71455058f92SEvan Bacon| Native   | `<Text style={[Custom]} />` |
71555058f92SEvan Bacon
71655058f92SEvan Bacon### `<TR/>`
71755058f92SEvan Bacon
71855058f92SEvan BaconUsed to create a Row in a Table.
71955058f92SEvan Bacon
72055058f92SEvan Bacon| Platform | Output                      |
72155058f92SEvan Bacon| -------- | --------------------------- |
72255058f92SEvan Bacon| Web      | `<tr />`                    |
72355058f92SEvan Bacon| Native   | `<View style={[Custom]} />` |
72455058f92SEvan Bacon
72555058f92SEvan Bacon### `<TD/>`
72655058f92SEvan Bacon
72755058f92SEvan BaconCreate a cell in a Table.
72855058f92SEvan Bacon
72955058f92SEvan Bacon- `colSpan` and `rowSpan` are currently web-only.
73055058f92SEvan Bacon
73155058f92SEvan Bacon| Platform | Output                      |
73255058f92SEvan Bacon| -------- | --------------------------- |
73355058f92SEvan Bacon| Web      | `<td />`                    |
73455058f92SEvan Bacon| Native   | `<View style={[Custom]} />` |
73555058f92SEvan Bacon
73655058f92SEvan Bacon### `<Caption/>`
73755058f92SEvan Bacon
73855058f92SEvan BaconUsed to caption your table. Excepts text as a child.
73955058f92SEvan Bacon
74055058f92SEvan Bacon| Platform | Output                      |
74155058f92SEvan Bacon| -------- | --------------------------- |
74255058f92SEvan Bacon| Web      | `<caption />`               |
74355058f92SEvan Bacon| Native   | `<Text style={[Custom]} />` |
74455058f92SEvan Bacon
745f4a8f663SEvan Bacon# TODO
74655058f92SEvan Bacon
74755058f92SEvan Bacon- Improve relative imports for better tree-shaking.
74855058f92SEvan Bacon
749f4a8f663SEvan Bacon# Babel
750f4a8f663SEvan Bacon
751f4a8f663SEvan BaconYou can write `react-dom` elements in your code and use the babel plugin to transform them to `@expo/html-elements` elements.
752f4a8f663SEvan Bacon
753f4a8f663SEvan Bacon```js
754f4a8f663SEvan Bacon// babel.config.js
755f4a8f663SEvan Baconmodule.exports = {
756f4a8f663SEvan Bacon  plugins: ['@expo/html-elements/babel'],
757f4a8f663SEvan Bacon};
758f4a8f663SEvan Bacon```
759f4a8f663SEvan Bacon
760f4a8f663SEvan Bacon## Input
761f4a8f663SEvan Bacon
762f4a8f663SEvan Bacon```js
763f4a8f663SEvan Baconexport default function Page() {
764f4a8f663SEvan Bacon  return (
765f4a8f663SEvan Bacon    <div>
766f4a8f663SEvan Bacon      <h1>Hello World</h1>
767f4a8f663SEvan Bacon    </div>
768f4a8f663SEvan Bacon  );
769f4a8f663SEvan Bacon}
770f4a8f663SEvan Bacon```
771f4a8f663SEvan Bacon
772f4a8f663SEvan Bacon## Output
773f4a8f663SEvan Bacon
774f4a8f663SEvan BaconThe import is automatically added if it's not already present. All props are passed through without any additional transforms.
775f4a8f663SEvan Bacon
776f4a8f663SEvan Bacon```js
777f4a8f663SEvan Baconimport { Div, H1 } from '@expo/html-elements';
778f4a8f663SEvan Bacon
779f4a8f663SEvan Baconexport default function Page() {
780f4a8f663SEvan Bacon  return (
781f4a8f663SEvan Bacon    <Div>
782f4a8f663SEvan Bacon      <H1>Hello World</H1>
783f4a8f663SEvan Bacon    </Div>
784f4a8f663SEvan Bacon  );
785f4a8f663SEvan Bacon}
786f4a8f663SEvan Bacon```
787f4a8f663SEvan Bacon
788f4a8f663SEvan Bacon# Contributing
78955058f92SEvan Bacon
79055058f92SEvan BaconContributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).
79155058f92SEvan Bacon
79255058f92SEvan Bacon[yoga]: https://yogalayout.com/
79355058f92SEvan Bacon
79455058f92SEvan Bacon<!-- HTML element links -->
79555058f92SEvan Bacon
79655058f92SEvan Bacon[html-a]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
79755058f92SEvan Bacon[html-article]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article
79868675f3eSEvan Bacon[html-aside]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside
79955058f92SEvan Bacon[html-b]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/b
80055058f92SEvan Bacon[html-blockquote]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote
80155058f92SEvan Bacon[html-br]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br
80255058f92SEvan Bacon[html-caption]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption
80355058f92SEvan Bacon[html-code]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code
80455058f92SEvan Bacon[html-del]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/del
805f4a8f663SEvan Bacon[html-div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div
80655058f92SEvan Bacon[html-em]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em
80755058f92SEvan Bacon[html-footer]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/footer
80868675f3eSEvan Bacon[html-form]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form
80955058f92SEvan Bacon[html-h1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h1
81055058f92SEvan Bacon[html-h2]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h2
81155058f92SEvan Bacon[html-h3]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h3
81255058f92SEvan Bacon[html-h4]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h4
81355058f92SEvan Bacon[html-h5]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h5
81455058f92SEvan Bacon[html-h6]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h6
81555058f92SEvan Bacon[html-header]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header
81655058f92SEvan Bacon[html-hr]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr
81755058f92SEvan Bacon[html-i]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/i
81855058f92SEvan Bacon[html-main]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main
81955058f92SEvan Bacon[html-mark]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark
82055058f92SEvan Bacon[html-nav]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/nav
82155058f92SEvan Bacon[html-ol]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol
82255058f92SEvan Bacon[html-p]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p
82355058f92SEvan Bacon[html-pre]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre
82455058f92SEvan Bacon[html-q]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q
82555058f92SEvan Bacon[html-s]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/s
82655058f92SEvan Bacon[html-section]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section
827f4a8f663SEvan Bacon[html-span]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span
82855058f92SEvan Bacon[html-small]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/small
82955058f92SEvan Bacon[html-strong]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong
83055058f92SEvan Bacon[html-table]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table
83155058f92SEvan Bacon[html-tbody]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody
83255058f92SEvan Bacon[html-td]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td
83355058f92SEvan Bacon[html-tfoot]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tfoot
83455058f92SEvan Bacon[html-th]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th
83555058f92SEvan Bacon[html-thead]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead
83655058f92SEvan Bacon[html-time]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time
83755058f92SEvan Bacon[html-tr]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr
83855058f92SEvan Bacon[html-ul]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul
83955058f92SEvan Bacon[html-li]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li
84068675f3eSEvan Bacon[html-label]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label
84155058f92SEvan Bacon[html-details]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
84255058f92SEvan Bacon[html-summary]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary
84355058f92SEvan Bacon[html-progress]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress
84455058f92SEvan Bacon[html-select]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
84555058f92SEvan Bacon[html-picture]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture
84655058f92SEvan Bacon[html-figure]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figure
84755058f92SEvan Bacon[html-figcaption]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figcaption
84855058f92SEvan Bacon[aria-banner]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Banner_role
849