| title | Getting started with CodeMonster UI |
|---|---|
| description | Install CodeMonster UI in Vue or Vanilla applications |
| order | 2 |
CodeMonster UI publishes one shared token and CSS layer, a Vue adapter, and an optional browser runtime for progressively enhanced server markup.
The examples below target the draft 2.0 cohort in this checkout. Install matching packages from the local build to try them in an application. For a registry install of stable Vue, follow the 1.1 release notes.
From the repository root, with the Node version in .nvmrc:
npm ci
npm run build
ui_tarballs="$(mktemp -d)"
npm pack --ignore-scripts --pack-destination "$ui_tarballs" \
--workspace @codemonster-ru/ui-tokens --workspace @codemonster-ru/ui-css \
--workspace @codemonster-ru/ui-runtime --workspace @codemonster-ru/ui-icons \
--workspace @codemonster-ru/ui-vue --workspace @codemonster-ru/ui-layouts \
--workspace @codemonster-ru/ui-utilitiesIn your consumer project, using the same shell, install the resulting tarballs together:
npm install "$ui_tarballs"/*.tgzUse Node ^22.22.3, ^24.15.0, or >=26.0.0 for Node consumers, including Vue SSR.
Vue integrations require Vue ^3.5.0. The package group depends on the integration:
| Integration | Workspaces to pack and install |
|---|---|
| Vue | Tokens, CSS, Runtime, Icons, and Vue. Add Layouts for page layouts and shells. |
| Vanilla with controllers | Tokens, CSS, and Runtime. Add Icons if you import icon geometry. |
| CSS only | Tokens and CSS. |
Add Utilities when using its utility stylesheet. For an app with no package manager or JS bundler, follow the standalone browser assets guide.
Use this entry as main.ts in an existing Vue app with an HTML element such as
<div id="app"></div>. Load tokens before component styles. The optional fonts entry supplies
the Inter font used by the showcase.
import { createApp } from 'vue';
import '@codemonster-ru/ui-tokens/tokens.css';
import '@codemonster-ru/ui-css/fonts.css';
import '@codemonster-ru/ui-css/styles.css';
import App from './App.vue';
createApp(App).mount('#app');Create App.vue next to this entry. Components keep application state in ordinary Vue refs.
<script setup lang="ts">
import { ref } from 'vue';
import { CmButton, CmField, CmInput } from '@codemonster-ru/ui-vue';
const email = ref('');
</script>
<template>
<form method="post">
<CmField control-id="account-email" label="Email" required>
<template #default="{ controlId, describedBy, invalid, required }">
<CmInput
:id="controlId"
v-model="email"
name="email"
type="email"
:aria-describedby="describedBy"
:invalid="invalid"
:required="required"
/>
</template>
</CmField>
<CmButton type="submit">Save account</CmButton>
</form>
</template>Import the components used by each module. Types are exported alongside components, for example
CmInputProps, and Vue can also infer them directly in the template. For JavaScript, use
main.js and remove lang="ts" from the Vue example.
For server rendering, use the same component imports and your framework's Vue SSR entry. Deliver the stylesheets through the browser build or the document layout. See the SSR and hydration guide.
Continue with a DataTable, a navigation menu, or a dialog. The theme recipe shows how to reuse the same preference in server rendering and hydration.
Follow the Vanilla quick start for copyable markup and JavaScript. Use the component reference to find the canonical HTML for the other components. Static components and native form controls work with CSS alone.
- Learn the token and theme contract.
- Choose and persist a theme in Vue or Vanilla.
- Choose complete or component-level entries in the CSS guide.
- Start with the Button, forms, and layout primitives.