no-html-elements rule disallows usage of standard HTML elements (<div>, <span>, <button>, etc.) in UI extensions.
Rule details
UI extensions only support components provided by the@hubspot/ui-extensions package. Standard HTML elements are not supported in the UI extensions runtime environment and will fail to render.
This rule detects and reports usage of any standard HTML elements in your extension code. Note that other third-party React component libraries are also not supported in UI extensions, though they are not currently linted by this rule.
HTML element alternatives
Use the following UI extension components instead of standard HTML elements:| HTML Element | UI Extension Component |
|---|---|
<div> | <Box> |
<p> | <Text> |
<span> | <Text inline> |
<h1> - <h6> | <Heading> |
<button> | <Button> |
<input> | <Input>, <NumberInput>, <DateInput>, etc. |
<img> | <Image> |
<a> | <Link> |
<ul>, <ol>, <li> | <List> |
<table>, <tr>, <td> | <Table>, <TableRow>, <TableCell> |
Examples
Container elements
Instead of using<div>, <p>, or <span>:
<Box>:
Text and heading elements
Instead of using<h1>, <p>, or other text elements:
<Heading> and <Text>:
Interactive elements
Instead of using<button>:
<Button>:
Media elements
Instead of using<img>:
<Image>: