components Svelte Themes

Components

Reusable svelte components for data projects

@njam-data/components

Reusable svelte components for data projects

Usage

<script>
  import BarChartTable from '@njam-data/components/BarChartTable.svelte'

  const data = [
    {
      "example": "Example 1",
      "A": .5,
      "B": .2,
      "C": .3
    },
    {
      "example": "Example 2",
      "A": .1,
      "B": .3,
      "C": .2
    },
    {
      "example": "Example 3",
      "A": .2,
      "B": .8,
      "C": .1
    }
  ]
</script>

<BarChartTable
  {data}
  width={400}
  height={150}
  yValue={'example'}
  barBackgroundColor={'#efefef'}
  margin={{
    top: 20,
    right: 0,
    bottom: 0,
    left: 65
  }}
/>

Developing

Once you've installed dependencies with npm install (or pnpm install or yarn), start a development server:

npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open

Building

Before creating a production version of your app, install an adapter for your target environment. Then:

npm run build

You can preview the built app with npm run preview, regardless of whether you installed an adapter. This should not be used to serve your app in production.

Potential components

Top categories

Loading Svelte Themes