npm.io
4.26.7 • Published 2 months ago

@cdc/data-bite

Licence
Apache-2.0
Version
4.26.7
Deps
6
Size
1.4 MB
Vulns
0
Weekly
0
Stars
55

@cdc/data-bite

npm

<CdcDataBite /> is a React component for displaying a single highlighted value in a card-style layout.

Installation

npm install @cdc/data-bite

Quick Start

Use the package by passing a config object directly:

import CdcDataBite from '@cdc/data-bite'

const config = {
  type: 'data-bite',
  version: '4.26.4',
  title: 'Data / Fact',
  biteBody: 'Highlight a statistic, data point, or key fact.',
  data: [{ Value: 1234 }],
  dataColumn: 'Value',
  dataFunction: 'Pass Through'
}

function App() {
  return (
    <div className='App'>
      <CdcDataBite config={config} />
    </div>
  )
}

export default App

You can also load configuration from a URL with <CdcDataBite configUrl='/path/to/config.json' />.

Configuration

The primary reference for authoring configs is CONFIG.md.

If you are reading this in a context where relative Markdown links do not open correctly, use the GitHub copy of the data bite config reference.

Properties

Property Type Description
config object Configuration object for the data bite. This is the primary integration path for React consumers.
configUrl string Optional URL to a JSON config file. Use this when you want the component to fetch its config at runtime.