<div align="center">

# @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.

[![npm version](https://img.shields.io/npm/v/@sylar_iii/ui?color=ec2fbd&label=npm)](https://www.npmjs.com/package/@sylar_iii/ui)
[![weekly downloads](https://img.shields.io/npm/dw/@sylar_iii/ui?color=ec2fbd&label=downloads)](https://www.npmjs.com/package/@sylar_iii/ui)
[![monthly downloads](https://img.shields.io/npm/dm/@sylar_iii/ui?color=ec2fbd&label=downloads)](https://www.npmjs.com/package/@sylar_iii/ui)
[![total downloads](https://img.shields.io/npm/dt/@sylar_iii/ui?color=ec2fbd&label=total)](https://www.npmjs.com/package/@sylar_iii/ui)
[![jsDelivr hits](https://img.shields.io/jsdelivr/npm/hm/@sylar_iii/ui?color=ec2fbd&label=jsDelivr)](https://www.jsdelivr.com/package/npm/@sylar_iii/ui)
[![license](https://img.shields.io/npm/l/@sylar_iii/ui?color=ec2fbd)](https://gitlab.com/Sylar-3/sylar-library/-/blob/main/projects/ui/LICENSE.txt)
[![types](https://img.shields.io/npm/types/@sylar_iii/ui?color=ec2fbd)](https://www.npmjs.com/package/@sylar_iii/ui)
[![unpacked size](https://img.shields.io/npm/unpacked-size/@sylar_iii/ui?color=ec2fbd&label=size)](https://www.npmjs.com/package/@sylar_iii/ui?activeTab=code)
[![last commit](https://img.shields.io/gitlab/last-commit/Sylar-3/sylar-library?color=ec2fbd)](https://gitlab.com/Sylar-3/sylar-library/-/commits/main)
[![GitLab stars](https://img.shields.io/gitlab/stars/Sylar-3/sylar-library?color=ec2fbd&style=flat&logo=gitlab)](https://gitlab.com/Sylar-3/sylar-library)

![Angular](https://img.shields.io/badge/Angular-19%2B-dd0031?logo=angular&logoColor=white)
![React](https://img.shields.io/badge/React-19-149eca?logo=react&logoColor=white)
![Vue](https://img.shields.io/badge/Vue-3-42b883?logo=vuedotjs&logoColor=white)
![Svelte](https://img.shields.io/badge/Svelte-5-ff3e00?logo=svelte&logoColor=white)
![HTML](https://img.shields.io/badge/HTML-Custom%20Elements-e34f26?logo=html5&logoColor=white)

<a href="https://sylar-library.vercel.app/#/portal/home" target="_blank" rel="noopener noreferrer"><strong>Website</strong></a> ·
<a href="https://sylar-library.vercel.app/#/portal/components/all" target="_blank" rel="noopener noreferrer"><strong>Components</strong></a> ·
<a href="https://sylar-library.vercel.app/#/portal/dashboard" target="_blank" rel="noopener noreferrer"><strong>Getting started</strong></a> ·
<a href="https://sylar-library.vercel.app/#/portal/icons" target="_blank" rel="noopener noreferrer"><strong>Icons</strong></a> ·
<a href="https://gitlab.com/Sylar-3/sylar-library/-/blob/main/projects/ui/THEMING.md" target="_blank" rel="noopener noreferrer"><strong>Theming</strong></a>

<br>

<a href="https://sylar-library.vercel.app/#/portal/home" target="_blank" rel="noopener noreferrer">
  <img src="https://sylar-library.vercel.app/assets/images/readme-ui-home.png" alt="Sylar UI documentation home page: live component previews, install command and framework switcher" width="100%">
</a>

</div>

## 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 <a href="https://sylar-library.vercel.app/#/portal/home" target="_blank" rel="noopener noreferrer">Sylar UI home page</a>.

## 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 gets `ngModel` / 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

```bash
npm install @sylar_iii/ui
# or
pnpm add @sylar_iii/ui
# or
yarn add @sylar_iii/ui
```

## Quick start

Load the theme once, then import each component's entry before it renders (importing defines the element):

```ts
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'
```

```html
<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.

<details>
<summary><strong>Angular 19+</strong></summary>

```ts
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`.

</details>

<details>
<summary><strong>React 19</strong></summary>

```tsx
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`).

</details>

<details>
<summary><strong>Vue 3</strong></summary>

```vue
<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`.

</details>

<details>
<summary><strong>Svelte 5</strong></summary>

```svelte
<script lang="ts">
  import '@sylar_iii/ui/button';
</script>

<sy-button type="button" appearance="soft" onclick={save}>Save</sy-button>
```

</details>

<details>
<summary><strong>Plain HTML (no build step)</strong></summary>

```html
<sy-button type="button" appearance="soft">Save</sy-button>

<script type="module">
  import 'https://esm.sh/@sylar_iii/ui@1/button';
</script>
```

</details>

## Components

| Component | Entry | What it does |
| --- | --- | --- |
| <a href="https://sylar-library.vercel.app/#/portal/components/button" target="_blank" rel="noopener noreferrer">Button</a> | `@sylar_iii/ui/button` | `<sy-button>`: appearances, severities, ripple, gradient, form-associated |
| <a href="https://sylar-library.vercel.app/#/portal/components/badge" target="_blank" rel="noopener noreferrer">Badge</a> | `@sylar_iii/ui/badge` | `<sy-badge>`: status labels in every severity and style |
| <a href="https://sylar-library.vercel.app/#/portal/components/input" target="_blank" rel="noopener noreferrer">Input</a> | `@sylar_iii/ui/input` | `<sy-input>`: text, password, OTP, select, multiselect, textarea; form-associated |
| <a href="https://sylar-library.vercel.app/#/portal/components/phone-number" target="_blank" rel="noopener noreferrer">Phone input</a> | `@sylar_iii/ui/phone-input` | `<sy-phone-input>`: country picker and phone validation |
| <a href="https://sylar-library.vercel.app/#/portal/icons" target="_blank" rel="noopener noreferrer">Icon</a> | `@sylar_iii/ui/icon` | `<sy-icon>`, `registerIcons`: built-in SVG icons in outline and filled styles |
| <a href="https://sylar-library.vercel.app/#/portal/components/grid-menu" target="_blank" rel="noopener noreferrer">Grid menu</a> | `@sylar_iii/ui/grid-menu` | `<sy-grid-menu>`: floating action menu, grid or radial |
| <a href="https://sylar-library.vercel.app/#/portal/components/sidebar" target="_blank" rel="noopener noreferrer">Sidebar</a> | `@sylar_iii/ui/sidebar` | `<sy-sidebar>`: router-agnostic navigation tree and mobile drawer |
| <a href="https://sylar-library.vercel.app/#/portal/misc/particle-cursor" target="_blank" rel="noopener noreferrer">Particle cursor</a> | `@sylar_iii/ui/particle-cursor` | `<sy-particle-cursor>`: canvas particles that follow the pointer |

<details>
<summary><strong>Other entries</strong></summary>

| 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 |

</details>

## Theming

Pick a preset or set your own colors on the <a href="https://sylar-library.vercel.app/#/portal/home" target="_blank" rel="noopener noreferrer">website</a> (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: <a href="https://gitlab.com/Sylar-3/sylar-library/-/blob/main/projects/ui/THEMING.md" target="_blank" rel="noopener noreferrer">THEMING.md</a>.

## Conventions

- Every option is an attribute (`text-color`) and a property (`textColor`). Booleans accept `attr="false"`. Arrays and objects are properties.
- Events are `CustomEvent`s with lowercase names (`itemclick`) and the payload in `event.detail`.
- Restyle with `--sylar-*` CSS variables, a `class` on the element, or `::part(...)`.
- Elements render in the browser. With server rendering they appear after hydration.

## Links

- <a href="https://sylar-library.vercel.app/#/portal/home" target="_blank" rel="noopener noreferrer">Website and live docs</a>
- <a href="https://gitlab.com/Sylar-3/sylar-library" target="_blank" rel="noopener noreferrer">Source code (GitLab)</a>
- <a href="https://gitlab.com/Sylar-3/sylar-library/-/issues" target="_blank" rel="noopener noreferrer">Report an issue or request a component</a>

If Sylar UI helps you, a ⭐ on <a href="https://gitlab.com/Sylar-3/sylar-library" target="_blank" rel="noopener noreferrer">GitLab</a> helps others find it.

## Author

Built by **Khair (Sylar) Al-Hamwi**.

<a href="https://sylar-potrfolio.vercel.app" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/Portfolio-ec2fbd?style=for-the-badge&logo=googlechrome&logoColor=white" alt="Portfolio"></a>
<a href="https://github.com/Sylar-3" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=github&logoColor=white" alt="GitHub"></a>
<a href="https://www.linkedin.com/in/khair-al-hamwi-0689a2212" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/LinkedIn-0a66c2?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn"></a>

## License

<a href="https://gitlab.com/Sylar-3/sylar-library/-/blob/main/projects/ui/LICENSE.txt" target="_blank" rel="noopener noreferrer">MIT</a> © Khair (Sylar) Al-Hamwi
