Frameworks
Install and use ARC UI in React, Vue, Svelte, Angular, Solid and Preact, or with no framework.
Overview
The core @arclux/arc-ui package is Lit custom elements, which work with any framework or none. Prism, the project's code generator, reads the Lit source and writes a wrapper package for each of the six frameworks below. A wrapper adds:
- Events bound the framework's way, such as React's
onClickand Vue's@click - TypeScript types for every prop
- Named imports per component, such as
{ Button, Card }
React
Published as
npm install @arclux/arc-ui-react @arclux/arc-ui lit
import '@arclux/arc-ui/base.css';
import { Button, Card, Input } from '@arclux/arc-ui-react';
function App() {
return (
<Card>
<h3>Sign In</h3>
<Input label="Email" placeholder="you@example.com" />
<Button variant="primary" onClick={() => console.log('clicked')}>
Submit
</Button>
</Card>
);
}
The React wrappers are built with @lit/react's createComponent, which handles event binding and ref forwarding.
Vue
Published as
npm install @arclux/arc-ui-vue @arclux/arc-ui lit
<script setup>
import '@arclux/arc-ui/base.css';
import { Button, Card } from '@arclux/arc-ui-vue';
</script>
<template>
<Card>
<h3>Hello Vue</h3>
<Button variant="primary" @click="handleClick">
Click Me
</Button>
</Card>
</template>
Svelte
Published as
npm install @arclux/arc-ui-svelte @arclux/arc-ui lit
<script>
import '@arclux/arc-ui/base.css';
import { Button, Card } from '@arclux/arc-ui-svelte';
</script>
<Card>
<h3>Hello Svelte</h3>
<Button variant="primary" on:click={() => console.log('clicked')}>
Click Me
</Button>
</Card>
Angular
Published as
npm install @arclux/arc-ui-angular @arclux/arc-ui lit
Add the stylesheet to your global styles, then import the standalone components:
/* styles.css */
@import '@arclux/arc-ui/base.css';
import { Component } from '@angular/core';
import { Button, Card } from '@arclux/arc-ui-angular';
@Component({
selector: 'app-hello',
imports: [Button, Card],
template: `
<arc-card>
<h3>Hello Angular</h3>
<arc-button variant="primary" (click)="handleClick()">
Click Me
</arc-button>
</arc-card>
`,
})
export class HelloComponent {
handleClick() {
console.log('clicked');
}
}
Solid
Published as
npm install @arclux/arc-ui-solid @arclux/arc-ui lit
import '@arclux/arc-ui/base.css';
import { Button, Card } from '@arclux/arc-ui-solid';
function App() {
return (
<Card>
<h3>Hello Solid</h3>
<Button variant="primary" onClick={() => console.log('clicked')}>
Click Me
</Button>
</Card>
);
}
Preact
Published as
npm install @arclux/arc-ui-preact @arclux/arc-ui lit
import '@arclux/arc-ui/base.css';
import { Button, Card } from '@arclux/arc-ui-preact';
function App() {
return (
<Card>
<h3>Hello Preact</h3>
<Button variant="primary" onClick={() => console.log('clicked')}>
Click Me
</Button>
</Card>
);
}
Without a wrapper
You don't need a wrapper. Every component is a standard custom element, so<arc-button> works in a framework template as soon as the element is registered. Use this path if you'd rather not add a dependency, or if you already write custom elements elsewhere in the app.
Register what you use, with a side-effect import per component or the whole catalog at once:
import '@arclux/arc-ui/base.css';
import '@arclux/arc-ui/button'; // just this element
import '@arclux/arc-ui/register'; // or every element
Telling your framework the tag is real
Vue and Angular need one setting so the compiler doesn't treat an unknown tag as a mistake or as one of its own components. Svelte and Solid need nothing.
// Vue — vite.config.js
export default {
plugins: [vue({
template: { compilerOptions: { isCustomElement: (tag) => tag.startsWith('arc-') } },
})],
};
// Angular — on the component or module that uses the tags
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
// …
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppComponent {}
Typed tags in JSX
React, Preact and Solid each get a generated declaration file that types every ARC UI tag, with the same props and enum unions as the wrapper packages.Add it to your program as a file. A types entry incompilerOptions does nothing here. TypeScript resolves typesas a package name and doesn't follow an export subpath, so the tags stay untyped and nothing reports an error.
{
"include": [
"src",
"node_modules/@arclux/arc-ui/types/react-jsx.d.ts"
]
}
Swap in preact-jsx.d.ts or solid-jsx.d.ts as needed, or reference the file from one module instead:/// <reference path="./node_modules/@arclux/arc-ui/types/solid-jsx.d.ts" />
What you give up
The difference is custom events. Solid binds them withon:arc-change={handler}, and its declaration file types it. React 19 and Preact 10 attach a function prop whose name starts with on as a listener for the rest of the name, as written, so onarc-change={handler}listens for arc-change. Their declaration files accept any on*prop, so a misspelled event name compiles and never fires.The wrapper packages give each event a typed handler prop, such asonArcChange.
Vanilla JS / CDN
Install the core package and import components directly:
npm install @arclux/arc-ui lit
import '@arclux/arc-ui/button';
import '@arclux/arc-ui/card';
@arclux/arc-ui-html has CSS-only versions of many components. They style plain HTML by class name and data-* attribute, and the package's examples/ folder has the markup for each.<!-- Full bundle -->
<link rel="stylesheet" href="https://unpkg.com/@arclux/arc-ui-html@4.9.2/css/arc-ui.css">
<!-- Individual component -->
<link rel="stylesheet" href="https://unpkg.com/@arclux/arc-ui-html@4.9.2/css/button.css">
<button class="arc-button arc-button--primary">Click Me</button>
See also
- Getting started: install ARC UI and render a first component
- Theming: dark, light and auto modes, and custom themes
- Browser support: supported browsers and polyfills