---
name: iyulab-components
description: Web component library built on Lit. Covers all u-* custom elements (buttons, forms, overlays, navigation, data display), utilities (Theme, Toast, Dialog, icons), and base classes for extension. Use when working with @iyulab/components package.
license: MIT
metadata:
  author: iyulab
---

# @iyulab/components

Web component library built on [Lit](https://lit.dev/). All components are custom elements (`u-*` tags) that work in any framework or vanilla HTML.

## Quick Start

Install the package:

```bash
npm install @iyulab/components
```

Initialize theme and import all components:

```ts
import { Theme } from '@iyulab/components';
import '@iyulab/components'; // registers all u-* custom elements

await Theme.init(); // optional — applies system/light/dark theme
```

Import individual components (tree-shakable) — and then import utilities individually too
(`@iyulab/components/dist/utilities/Theme.js`): the barrel registers every component even when you take one value from it:

```ts
import '@iyulab/components/dist/components/button/UButton.js';
import '@iyulab/components/dist/components/input/UInput.js';
```

React wrappers (requires `@lit/react`):

```ts
import { UButton, UInput } from '@iyulab/components/react';
```

> For detailed guidance on theming, icon setup, and advanced usage, see [./references/usage.md](./references/usage.md).

> **Browser support:** the floor is the browsers that support `:state()` without the `--` prefix — Chrome/Edge 125, Firefox 126, Safari 17.4. Form controls expose states through `ElementInternals.states`, which throws on older engines (for example Chromium 120), so there is nothing to polyfill.

> **Direction:** layout follows the document direction — under `dir="rtl"` the prefix/suffix slots, inner padding and borders mirror (logical CSS properties). Placement values that name a physical side (`u-drawer placement="left"`, `u-tab-panel placement`) stay physical. The chevrons a component draws itself mirror too (breadcrumb separator, previous/next in pagination and calendar, the closed marker of expander and tree item, the submenu marker) — a chevron you pass through a `separator` or `expand-icon` slot stays as you drew it. Script-positioned parts follow the pointer and the arrow keys in a right-to-left page (`u-split-panel`, `u-slider`, `u-rating`, `u-carousel`). The badge corner placements stay physical on purpose; the virtualized grid and spreadsheet are mirrored in `@iyulab/flex-table` and `@iyulab/data-components`, and the timeline keeps time left to right. Values the app puts in (a name, a part number, a signed number) read in their own direction instead of the page's — `u-tag`, `u-chip`, `u-option`, `u-breadcrumb-item`, `u-button`, `u-menu-item`, `u-tree-item`, `u-checkbox`, `u-radio`, `u-switch`, `u-tab`, `u-badge`, the `u-divider` text, the `u-progress-bar` content, the `u-steps` titles and the closed `u-select` trigger isolate their one-line label with a shadow-tree `bdi` (`Blue Harbor Co.` stays `Blue Harbor Co.` in an RTL page; alignment is unchanged). Sentences (toast and alert bodies, descriptions) follow the page; wrap a value you interpolate into a sentence in `<bdi>` yourself.

---

## Components

### Feedback

- [`u-alert`](./references/components/alert.md) — Closable message banner with status variants and auto-dismiss
- [`u-spinner`](./references/components/spinner.md) — Animated loading indicator
- [`u-skeleton`](./references/components/skeleton.md) — Placeholder shape shown while content loads
- [`u-progress-bar`](./references/components/progress-bar.md) — Linear progress indicator with buffer and segment support
- [`u-progress-ring`](./references/components/progress-ring.md) — Circular progress indicator

### Buttons & Actions

- [`u-button`](./references/components/button.md) — Versatile button with multiple appearances; renders as `<a>` when `href` is set
- [`u-icon-button`](./references/components/icon-button.md) — Square icon-only button with built-in tooltip
- [`u-copy-button`](./references/components/copy-button.md) — Copies text to the clipboard with a transient confirmation
- [`u-button-group`](./references/components/button-group.md) — Groups buttons with shared appearance and disabled state

### Form Controls

- [`u-input`](./references/components/input.md) — Text input; combobox mode when `u-option` children are present
- [`u-textarea`](./references/components/textarea.md) — Multi-line text input with auto-resize and character counter
- [`u-select`](./references/components/select.md) — Dropdown select; single or multiple, with search
- [`u-date-picker`](./references/components/date-picker.md) — Single-date(-time) selection with a popover calendar
- [`u-date-range-picker`](./references/components/date-range-picker.md) — A period of days in one field (`start/end`), picked in a two-month calendar
- [`u-file-input`](./references/components/file-input.md) — File picker with a design-system trigger button and selected-file(s) display
- [`u-checkbox`](./references/components/checkbox.md) — Checkbox with indeterminate state support
- [`u-radio`](./references/components/radio.md) — Radio group built from `u-option` children
- [`u-switch`](./references/components/switch.md) — Toggle switch
- [`u-slider`](./references/components/slider.md) — Range slider; single-thumb or dual-thumb (range) mode
- [`u-rating`](./references/components/rating.md) — Star/custom-symbol rating input
- [`u-field`](./references/components/field.md) — Layout wrapper providing label, description, and validation message
- [`u-form`](./references/components/form.md) — Form group with two-way model binding and validation
- [`u-option`](./references/components/option.md) — Selectable option item for `u-select`, `u-radio`, `u-input`
- [`u-option-group`](./references/components/option-group.md) — Labelled group of `u-option`s in `u-select` / `u-input` (the native `<optgroup>`)

**`disabled` is exposed where assistive technology and test tools look for it** — on the node that
carries the control's role, not on the host element. Native nodes use native `disabled`
(`u-input`, `u-textarea`, `u-checkbox`, `u-switch`, `u-file-input`); role nodes get
`aria-disabled="true"` (the `combobox` of `u-select`/`u-date-picker`, the `radiogroup` of
`u-radio`/`u-rating`, the `slider` thumbs). In end-to-end tests, locate controls by role
(`getByRole('combobox')`) rather than by tag, so actionability checks see the disabled state.

**Roles that belong to the host are host attributes**, so DOM-based role queries (Playwright, Testing
Library) and axe-core see what assistive technology sees: `u-dialog`/`u-drawer` are `dialog` named by
their `header` slot (`Dialog.alert`/`confirm` are `alertdialog`), `u-field` over several controls is a
`group` named by its label, `u-progress-bar`/`u-progress-ring`/`u-spinner` are `progressbar` with
`aria-value*`, `u-carousel` is a `region`, and `u-tree-item` is named by its own label. Write
`getByRole('dialog', { name: 'Delete item' })` — not a tag selector. A `role` or `aria-*` attribute you
set on the host yourself always wins and is never overwritten.

### Overlay & Floating

- [`u-dialog`](./references/components/dialog.md) — Modal/non-modal dialog with configurable placement
- [`u-drawer`](./references/components/drawer.md) — Side-panel that slides in from any edge
- [`u-command-palette`](./references/components/command-palette.md) — Find-anything dialog (Ctrl/⌘ K style): a search field over results grouped by source, async sources with cancellation
- [`u-popover`](./references/components/popover.md) — Anchored floating panel with flexible trigger/dismiss policies
- [`u-tooltip`](./references/components/tooltip.md) — Hover/focus tooltip anchored to a target element

### Navigation

- [`u-breadcrumb`](./references/components/breadcrumb.md) — Hierarchical location indicator
- [`u-breadcrumb-item`](./references/components/breadcrumb.md) — Individual breadcrumb link/label
- [`u-pagination`](./references/components/pagination.md) — Page navigation: range and total, page numbers, rows per page (zero-based `page`)
- [`u-menu`](./references/components/menu.md) — Menu container with keyboard navigation and selection modes
- [`u-menu-item`](./references/components/menu.md) — Menu entry with optional sub-menu
- [`u-tab-panel`](./references/components/tab-panel.md) — Tab-based content switcher
- [`u-tab`](./references/components/tab-panel.md) — Individual tab button used inside `u-tab-panel`; with `href`, a link tab for `u-tab-nav`
- [`u-tab-nav`](./references/components/tab-nav.md) — Tab strip of links (saved views): a `<nav>` with `aria-current`, not a tablist
- [`u-tree`](./references/components/tree.md) — Hierarchical tree with select, check, and drag-and-drop
- [`u-tree-item`](./references/components/tree.md) — Individual node inside `u-tree`

### Layout & Display

- [`u-card`](./references/components/card.md) — Content card with media, header, and footer slots
- [`u-auto-scroll`](./references/components/auto-scroll.md) — A box that scrolls its overflowing content by itself, for a screen nobody touches (wall display, kiosk)
- [`u-carousel`](./references/components/carousel.md) — Slide carousel with autoplay, navigation, and pagination (dots, or named tabs with progress for a wall display)
- [`u-split-panel`](./references/components/split-panel.md) — Resizable two-panel layout
- [`u-panel`](./references/components/panel.md) — General-purpose content panel
- [`u-expander`](./references/components/expander.md) — Disclosure section; header toggles the body open/closed
- [`u-divider`](./references/components/divider.md) — Horizontal or vertical separator line

### Data Display

- [`u-avatar`](./references/components/avatar.md) — User avatar with image, initials, or custom slot
- [`u-badge`](./references/components/badge.md) — Status badge; can be anchored on top of other elements
- [`u-chip`](./references/components/chip.md) — Selectable/removable chip tag
- [`u-tag`](./references/components/tag.md) — Non-interactive label tag
- [`u-icon`](./references/components/icon.md) — SVG icon from built-in or external icon library
- [`u-text`](./references/components/text.md) — Semantic typography step; optional heading level
- [`u-steps`](./references/components/steps.md) — Display-only progress line: complete, current, on-hold and upcoming steps

---

## Utilities

- [`Theme`](./references/utilities/theme.md) — Apply and manage light/dark/system theme
- [`Toast`](./references/utilities/toast.md) — Programmatically show toast notifications
- [`Dialog`](./references/utilities/dialog.md) — Programmatically show alert/confirm/prompt dialogs
- [`IconRegistry`](./references/utilities/icons.md) — Register and resolve icon libraries
- [`BrowserStorage`](./references/utilities/browser-storage.md) — Unified localStorage / Cookie API
- [`converters`](./references/utilities/converters.md) — Lit property attribute converters (array, JSON, date, url…)
- [`Locale`](./references/utilities/locale.md) — Validation-message locale registry and lookup utility · search matching (`matchesSearch` — Hangul jamo and initials) · text order (`compareText` — digit runs as numbers, the app locale)
- [`elements`](./references/utilities/elements.md) — Shadow-DOM-aware DOM query helpers
- [`format`](./references/utilities/format.md) — Locale-aware number, currency and date formatting
- [`number-format`](./references/utilities/number-format.md) — One number format for tables, sheets and widgets: spreadsheet codes or `Intl` options
- [`clipboard`](./references/utilities/clipboard.md) — `copyFromKey` / `pasteFromKey` / `isTextEntry`, Ctrl/Cmd + C · X · V for a grid or list selection in every browser (Safari fires no copy event without a text selection)
- [`keyboard`](./references/utilities/keyboard.md) — `isImeComposing` for Enter handlers that must not fire mid-composition (Korean/Japanese/Chinese input) · `CompositionTracker` / `replayInput` for inputs that filter as you type
- [`tsv`](./references/utilities/tsv.md) — `encodeTsv` / `decodeTsv`, the spreadsheet clipboard format with RFC 4180 quoting
- [`listen-in-shadow`](./references/utilities/listen-in-shadow.md) — `delegate` / `listenInShadow`, handlers for shadow-tree parts heard on the shadow root, so screen readers do not announce those parts as «clickable»
- [`OverlayManager`](./references/utilities/overlay-manager.md) — Internal overlay stack and z-index manager

---

## Extensions

`@iyulab/components` exposes abstract base classes you can extend to build custom components that integrate seamlessly with the library's patterns (form association, overlays, floating positioning, etc.).

> See [./references/extensions/](./references/extensions/) for per-class details.

- [`UElement`](./references/extensions/element.md) — Root base for all components; provides `fire()`, `relay()`, `replace()` helpers
- [`UFormControlElement<T>`](./references/extensions/form-control.md) — Base for form-associated controls; handles `disabled`, `readonly`, `invalid`, validation lifecycle
- [`UFloatingElement`](./references/extensions/floating.md) — Base for anchored floating UI (popover, tooltip); wraps `@floating-ui/dom`
- [`UOverlayElement`](./references/extensions/overlay.md) — Base for full-screen overlays (dialog, drawer); manages focus-trap, scroll-lock, ESC/backdrop close

## Machine-readable reference

The element surface is also published as a Custom Elements Manifest: the file named by the `customElements` field of this package's `package.json` (`dist/custom-elements.json`). It lists every element's attributes, properties, events (with the type of their `detail`), slots, CSS parts and CSS custom properties, generated from the source at build time. Read it instead of parsing the source when you need the exact surface of an element.
