Getting started
The components are native custom elements — the same <c-*> tags work in every framework. Pick your flavor with the switcher in the header; the whole documentation, examples included, follows your choice.
Install
The core package ships the custom elements, their TypeScript types, and the design tokens.
pnpm add @cscfi/csc-uiSet up
Import the design tokens, register the elements once at startup, and tell Vue that c-* tags are custom elements (not Vue components).
import '@cscfi/csc-ui/css/tokens.css';
import { createApp } from 'vue';
import { defineCustomElements } from '@cscfi/csc-ui';
import App from './App.vue';
defineCustomElements();
createApp(App).mount('#app');import vue from '@vitejs/plugin-vue';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [
vue({
template: {
// c-* tags are custom elements, not Vue components
compilerOptions: { isCustomElement: (tag) => tag.startsWith('c-') },
},
}),
],
});Use a component
The elements support plain v-model — no directives or wrappers needed.
<template>
<c-button @click="count++">Clicked {{ count }} times</c-button>
<c-switch v-model="enabled">Notifications</c-switch>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const count = ref(0);
const enabled = ref(false);
</script>Accessibility
ARIA attributes on a component reach the control inside it: aria-label names a button, a dialog, or a field without a visible label (beside a label, the label names the field, so its name matches what is on screen). The attributes that point at elements by id work too (aria-labelledby, aria-describedby, aria-controls and the rest): the component looks the ids up where the element is written, your page or the shadow root around it, and hands those elements to its control. It looks them up when it renders, when the attribute changes and when the control takes focus, so an element your page renders later is found by then. A field's hint and error message are read out with it when it takes focus, but an error that appears is not announced: after a failed submit, move focus to the first invalid field with its focus() method (each form control focuses its input, its checked radio or its first box), or to an error summary at the top of the form.
<p id="plan-help">Billed monthly. Change your plan at any time.</p>
<c-select label="Plan" aria-describedby="plan-help"></c-select>
<c-text-field aria-label="Search projects"></c-text-field>// After a failed submit, take the user to the first invalid field: its
// hint and error message are read out as it takes focus.
form.querySelector<HTMLElement>('[invalid]')?.focus();Theming & dark mode
Components follow the OS light/dark preference by default; set data-theme="light" or "dark" on <html> to pin a mode explicitly. To re-brand, hand applyTheme one seed colour per family you want to override — the full ramp and both modes regenerate from it. Components draw in your page's font and line height, so set them on body.
import { applyTheme } from '@cscfi/csc-ui';
// Step-500 seed per family; ramps and dark mode derive from it.
applyTheme({ primary: '#006efd' });Customization guide — theming, dark mode, parts, typography, Tailwind →
Supported browsers
The components support the current and previous versions of Chrome, Edge, Firefox and Safari, Safari on iOS included, plus Firefox ESR, the extended-support release that Red Hat Enterprise Linux ships (140 today). Every component's behaviour is tested on Chromium, Firefox and WebKit before a release, and a fault in a supported browser is a bug. Older browsers may work, but nothing is tested or promised for them. The package declares the same list as its browserslist query:
last 2 Chrome versions
last 2 Edge versions
last 2 Firefox versions
Firefox ESR
last 2 Safari versions
last 2 iOS versions