Skip to content

Getting started ​

Install the package, import the components you need, and you are done — the styles ship with the library.

Installation ​

bash
1pnpm add @dowardev/herdrate-vue

Or with npm:

bash
1npm install @dowardev/herdrate-vue

Vue is a peer dependency: the library requires vue ^3.4 and does not bundle it, so make sure your project already has Vue 3.4 or newer installed.

prettier ^3 is a second, optional peer dependency, and it is only needed if you format code yourself: the library loads Prettier only when you pass a formatter built with usePrettierFormatter() to <CodeBlock>. Install prettier yourself (plus the plugins for the languages you use — they are never installed for you) if that is your plan.

Import ​

Every component is exported from the package root:

ts
1import { Button, Panel } from '@dowardev/herdrate-vue';

Composables and types come from the same entry point:

ts
1import { useDesign, useToast, DEFAULT_COLOR } from '@dowardev/herdrate-vue';2import type { Color, Fill, DesignLine } from '@dowardev/herdrate-vue';

The package exposes a single root export (.). There are no per-component subpaths, so @dowardev/herdrate-vue/button does not exist — always import from @dowardev/herdrate-vue.

The package is ESM-only: it ships an import condition and no require condition, so require() from CommonJS does not resolve. Use an ESM build, or a dynamic import() from CommonJS.

Styles ​

The CSS is injected automatically as soon as any component is imported. There is no stylesheet to import and no CSS file to configure: importing a component is enough.

Usage ​

vue
1<script setup lang="ts">2import { Button, Panel } from '@dowardev/herdrate-vue';3</script>45<template>6  <Panel divider>7    <template #header>Panel demo</template>8    <Button color="primary" @click="handleClick">Click me</Button>9    <template #footer>Panel footer</template>10  </Panel>11</template>

Live example ​

The same markup, rendered by this site:

📦 Panel demo
This panel is rendered live from the markdown of this page.
────
PrimarySuccessWarningDanger

Next steps ​