Getting started
Install
@multiconsult-group-products/design-system is ESM-only. Its Mantine and React dependencies are peer
dependencies — the package never bundles them, so the application supplies one
copy that everything shares.
npm install @multiconsult-group-products/design-system \
react react-dom \
@mantine/core @mantine/hooks @mantine/dates @mantine/dropzone @mantine/tiptap \
@tiptap/react @tiptap/pm
The two Tiptap packages are peers rather than dependencies because
@mantine/tiptap requires the exact same instance the application uses. Two
copies in one tree fail at runtime, not at install time.
TanStack React Table, TanStack Form, Recharts and the Inter font are ordinary dependencies — they travel with the package and need no action.
Import the stylesheets
Order matters. Mantine's sheets first, the design system's last, so its overrides win the cascade:
import '@mantine/core/styles.css';
import '@mantine/dates/styles.css';
import '@mantine/dropzone/styles.css';
import '@mantine/tiptap/styles.css';
import '@multiconsult-group-products/design-system/styles.css';
Drop the sheets for the parts you do not use — @mantine/tiptap is only needed
if the application renders RichTextField.
Mount the provider
The theme and the CSS variable resolver both come from the package, and both are
required: the resolver is what defines the semantic tokens
(--mantine-color-surface, --mantine-color-button-pressed and the rest) and
re-points them per colour scheme.
useFocusModality is also required, not optional — several style overrides
(text inputs among them) key off the data-focus-modality attribute it writes
on <html> to keep the focus ring keyboard-only. Skipping it means those
components show a focus ring on mouse click too.
import { MantineProvider } from '@mantine/core';
import {
theme,
cssVariablesResolver,
useFocusModality,
} from '@multiconsult-group-products/design-system';
export function App({ children }: { children: React.ReactNode }) {
useFocusModality();
return (
<MantineProvider theme={theme} cssVariablesResolver={cssVariablesResolver}>
{children}
</MantineProvider>
);
}
Render something
A themed Mantine component needs no import from the design system — the provider
above is what makes it look right. None of them are re-exported by
@multiconsult-group-products/design-system: the package exports the theme and the custom
components; everything else is styled through MantineProvider, as configured
above.
import { Button } from '@mantine/core';
<Button variant="primary">Lagre</Button>;
A component built here comes from the package:
import { KeyValue } from '@multiconsult-group-products/design-system';
<KeyValue label="Oppdragsnummer" value="123456" />;
What the package exports
The public API is exactly what src/index.ts re-exports — nothing else is
reachable, and nothing else is supported.
| Export | What it is |
|---|---|
theme | The Mantine theme, with all component registrations |
cssVariablesResolver | The semantic token layer, per colour scheme |
IconSize | Numeric icon sizes for Tabler icons |
Duration | Motion durations in milliseconds |
useFocusModality | Hook that distinguishes keyboard focus from pointer focus |
| Palettes | blue, teal, green, red, orange, yellow, purple, darkGrey, lightGrey, warmGrey |
| Components | The eleven built here |
tools/apca.ts — the contrast measurement used when authoring colours — sits
outside src on purpose and is deliberately not exported.