@sylar_iii/ui
v1.0.1
Published
Framework-agnostic Web Components UI library: buttons, inputs, OTP, select, phone input, icons, sidebar and themes. Works in Angular, React, Vue, Svelte and plain HTML. Zero UI dependencies.
Maintainers
Keywords
Readme
@sylar_iii/ui
Web Components that wear your theme, in any framework.
Typed, accessible <sy-*> components for Angular, React, Vue, Svelte and plain HTML: one shared theme, live docs and a ready-to-paste AI prompt for every component. No runtime framework, UI kit or icon pack.
Website · Components · Getting started · Icons · Theming
Sylar UI website
Live demos, a live editor for every option, per-framework copyable code and a ready-to-paste AI prompt for every component live on the Sylar UI home page.
Why Sylar UI
- One package, every framework. Standard Custom Elements with Shadow DOM: the same
<sy-button>works in Angular, React, Vue, Svelte and plain HTML. - Zero UI dependencies. No framework runtime, no UI kit, no icon pack. Only the browser platform.
- Themeable. Dark and light presets plus your own palette through
--sylar-*CSS variables, plain CSS or Sass. - Real form fields. Inputs are form-associated (
ElementInternals): native<form>works everywhere, and Angular getsngModel/ reactive forms through@sylar_iii/ui/angular. - Typed. TypeScript types for every element, plus typed JSX (React) and global components (Vue).
- Accessible. Keyboard support, labels and ARIA, RTL-ready logical properties, reduced-motion support.
- AI-ready. Every docs page generates a self-contained prompt for your coding assistant, for your framework and your theme.
- Tree-shakeable entries. Import only the components you use.
Install
npm install @sylar_iii/ui
# or
pnpm add @sylar_iii/ui
# or
yarn add @sylar_iii/uiQuick start
Load the theme once, then import each component's entry before it renders (importing defines the element):
import '@sylar_iii/ui/theme/css/base.css';
import '@sylar_iii/ui/theme/css/default.css';
import '@sylar_iii/ui/button';
document.documentElement.dataset['theme'] = 'dark'; // or 'light'<sy-button type="button" appearance="soft">Save</sy-button>Framework setup (Angular CUSTOM_ELEMENTS_SCHEMA, Vue isCustomElement, typed React JSX, …) is generated for your framework on every component page.
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@sylar_iii/ui/button';
@Component({
selector: 'app-example',
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `<sy-button type="button" appearance="soft" (click)="save()">Save</sy-button>`,
})
export class ExampleComponent {
save(): void {}
}Forms: add SY_FORMS from @sylar_iii/ui/angular to imports to bind sy-input and sy-phone-input with [(ngModel)], formControl or formControlName.
import '@sylar_iii/ui/button';
export function Example() {
return <sy-button type="button" appearance="soft" onClick={() => save()}>Save</sy-button>;
}Typed tags: add import type {} from '@sylar_iii/ui/jsx'; to a file the compiler reads (for example src/sylar-ui.d.ts).
<script setup lang="ts">
import '@sylar_iii/ui/button';
</script>
<template>
<sy-button type="button" appearance="soft" @click="save">Save</sy-button>
</template>In vite.config.ts: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.startsWith('sy-') } } }). Typed tags: add import type {} from '@sylar_iii/ui/vue'; to src/env.d.ts.
<script lang="ts">
import '@sylar_iii/ui/button';
</script>
<sy-button type="button" appearance="soft" onclick={save}>Save</sy-button><sy-button type="button" appearance="soft">Save</sy-button>
<script type="module">
import 'https://esm.sh/@sylar_iii/ui@1/button';
</script>Components
| Component | Entry | What it does |
| --- | --- | --- |
| Button | @sylar_iii/ui/button | <sy-button>: appearances, severities, ripple, gradient, form-associated |
| Badge | @sylar_iii/ui/badge | <sy-badge>: status labels in every severity and style |
| Input | @sylar_iii/ui/input | <sy-input>: text, password, OTP, select, multiselect, textarea; form-associated |
| Phone input | @sylar_iii/ui/phone-input | <sy-phone-input>: country picker and phone validation |
| Icon | @sylar_iii/ui/icon | <sy-icon>, registerIcons: built-in SVG icons in outline and filled styles |
| Grid menu | @sylar_iii/ui/grid-menu | <sy-grid-menu>: floating action menu, grid or radial |
| Sidebar | @sylar_iii/ui/sidebar | <sy-sidebar>: router-agnostic navigation tree and mobile drawer |
| Particle cursor | @sylar_iii/ui/particle-cursor | <sy-particle-cursor>: canvas particles that follow the pointer |
| Entry | Contents |
| --- | --- |
| @sylar_iii/ui/angular | SY_FORMS: ngModel and reactive forms for sy-input and sy-phone-input |
| @sylar_iii/ui/services | stringToColor, generateQRCode, verifyEntity, onVerifyEntityFailure, emitVerifyEntityFailure |
| @sylar_iii/ui/types | SySeverity, country, language and phone types |
| @sylar_iii/ui/all | Every element and type in one import |
| @sylar_iii/ui/jsx | Typed React JSX for every <sy-*> tag (type-only) |
| @sylar_iii/ui/vue | Typed Vue global components for every <sy-*> tag (type-only) |
| @sylar_iii/ui/theme/css/*.css | Theme as plain CSS: base.css plus one preset (default.css, lime.css, …) |
| @sylar_iii/ui/theme/*.scss | The same theme as Sass |
Theming
Pick a preset or set your own colors on the website (palette button in the top bar). Every element reads the shared --sylar-* tokens, so one change restyles the whole app. Full guide, custom palettes and element hooks: THEMING.md.
Conventions
- Every option is an attribute (
text-color) and a property (textColor). Booleans acceptattr="false". Arrays and objects are properties. - Events are
CustomEvents with lowercase names (itemclick) and the payload inevent.detail. - Restyle with
--sylar-*CSS variables, aclasson the element, or::part(...). - Elements render in the browser. With server rendering they appear after hydration.
Links
- Website and live docs
- Source code (GitLab)
- Report an issue or request a component
If Sylar UI helps you, a ⭐ on GitLab helps others find it.
Author
Built by Khair (Sylar) Al-Hamwi.
License
MIT © Khair (Sylar) Al-Hamwi
