Web components for embedding Hub into websites and custom applications.
- Containers - full-featured composition of multiple blocks + elements, optionally managing state
- Blocks - 'Smart' components (optionally) managing data; composed of elements, and maybe other blocks
- Presentation - Functional presentation components that only contain other elements
Containers are complex, manage state and are used for prototypes and optionally as larger reusable components. For example, Content Picker or Discussion
Blocks are the most common component that can be used stand-alone within a card or website by providing configuration to either fetch new data or display data that is provided. Examples include Event List or Data Statistic
Presentation provide consistent presentation but do not interact with outside systems.
There are many components which may work as both a Block or Presentation, for example Data Statistic. This example component could be configured with static strings + values; or it could be configured with a data reference + statistical operations. At first this component can be a single block with minimal logic that's delegated to an external library (e.g. Hub.js). Only when the Block becomes sufficiently complex, or there are variations (or desired re-used in the presentation) then this Block could be decomposed into external Presentation components.
Add <script src='https://unpkg.com/@esri/radar@0.1.15/dist/radar.js'></script>
in the head of your index.html
- Then you can use the element anywhere in your template, JSX, html etc
To use Hub components in a React application, see Stencil.js docs on React
To use Hub components in an Ember application, use ember-cli-stencil
- Run
ember install ember-cli-stencil ember-auto-import
- Run
npm install @esri/radar --save
- Run
npm install hub-radar --save
- Add an import to the npm packages
import hub-radar;
- Then you can use the element anywhere in your template, JSX, html etc
npm install
npm start
To build a new component:
npx stencil g
Please preface all component files with hub-
and component modules with Hub
for example hub-map.tsx
annd HubMap
See Stencil Cheatsheet for great tips developing with Stencil.
To view the components in an explorable player:
npm run storybook
To build the component for production, run:
npm run build
To publish storybook to GitHub pages
npm run deploy-storybook
To run the unit tests for the components, run:
npm test
Need help? Check out our docs here.