JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 81
  • Score
    100M100P100Q82568F
  • License MIT

Framework-agnostic, Light DOM web components. CSS is the source of truth.

Package Exports

  • @ryanhelsing/ry-ui
  • @ryanhelsing/ry-ui/css/ry-base.css
  • @ryanhelsing/ry-ui/css/ry-components.css
  • @ryanhelsing/ry-ui/css/ry-layout.css
  • @ryanhelsing/ry-ui/css/ry-structure.css
  • @ryanhelsing/ry-ui/css/ry-theme.css
  • @ryanhelsing/ry-ui/css/ry-tokens.css
  • @ryanhelsing/ry-ui/css/ry-ui.css
  • @ryanhelsing/ry-ui/themes/dark.css
  • @ryanhelsing/ry-ui/themes/light.css
  • @ryanhelsing/ry-ui/themes/ocean.css

Readme

ry-ui

Framework-agnostic, Light DOM web components. CSS is the source of truth.

North Star

There are only so many types of things we do in any app. There should be one opinionated default way to do each of them. Invent all the wheels once, then never again.

Every app is a composition of the same finite primitives: layout, navigation, data display, data entry, feedback, actions, auth, state. The patterns are solved. The industry just keeps re-solving them because engineers enjoy the puzzle.

ry-ui normalizes this. No decisions to make. No architecture to debate. An LLM can leverage these primitives to build any app, anywhere, with a structure that is grokkable, dumb, and repeatable. Over-engineering becomes irrelevant when there's nothing left to over-engineer.

The goal: Write once in HTML/CSS/JS. Deploy to web, iOS, Android, desktop. The primitives are portable because they're universal.


  • separate the css minimal structure from the theme
  • separate the component behavior from the design (see docs/arch/behavior-style-separation.md)

Next Up — Missing Primitives That Block Real Apps

  • Table / Data Grid — sorting, column resize, virtual scrolling for large datasets. Highest-value missing component for any dashboard.
  • Form — form orchestration around existing inputs. Validation, error states, submit handling, field grouping.
  • Menu / Context Menu — right-click menus, nested submenus. Required for any desktop-targeting app.
  • Command Palette — Cmd+K pattern. Table stakes for power-user apps and ry-os.
  • Toast stacking — ry-toast exists but needs positioning, stacking multiple toasts, auto-dismiss timers, queue behavior.
  • Breadcrumb, Pagination, Stepper — navigation patterns for any multi-page app.

Backlog

  • Placeholder, Step/Wizard, Loader/Progress, Comment/Feed, Statistic/Graph, Hero, Calendar, Rating, Search, Shape, Sticky, dialog/alert, carousel, qr-code, diff, split-panel, format-bytes-number-currency, mutation-observer and resize observer

  • This is a theme on its own: https://codepen.io/oathanrex/pen/EayVMqZ

  • bring in examples and extract and normalize - Flat Clean (accord/tailwind) / Flat Fun Waves (zevo) / Game (mario/astrobot/stardew/animal crossing) / Brute (square game) / Skeuomorphic / Glass ( dark and light, color sets 1,2,3 )

  • cross-platform transpiler - Swift/SwiftUI (see docs/arch/cross-platform-transpiler.md)

  • animation system with GSAP (see docs/plans/animation-system.md)

  • could use to write apps on ry-os lol.. rust based linux DE with html/js/css -> Dioxus -> rust apps / with an llm on device

  • https://github.com/GrapheneOS — hardened Android, good reference for security-first OS/DE design patterns

Quick Start

<link rel="stylesheet" href="https://cdn.example.com/ry-ui.css">
<script type="module" src="https://cdn.example.com/ry-ui.js"></script>

Components

Layout (CSS-only)

  • <ry-page> - Page container
  • <ry-header> / <ry-footer> - Page sections
  • <ry-main> / <ry-section> - Content areas
  • <ry-grid cols="3"> - Responsive grid
  • <ry-stack> / <ry-cluster> - Flex layouts

Interactive

  • <ry-button> - Buttons with variants
  • <ry-modal> - Modal dialogs
  • <ry-drawer> - Slide-out panels
  • <ry-accordion> - Collapsible sections
  • <ry-tabs> - Tabbed content
  • <ry-dropdown> - Dropdown menus
  • <ry-select> - Custom select
  • <ry-switch> - Toggle switch
  • <ry-tooltip> - Hover tooltips
  • <ry-toast> - Notifications

Display

  • <ry-card> - Card containers
  • <ry-badge> - Status badges
  • <ry-alert> - Alert messages

Clean Syntax

Use <ry> wrapper to write unprefixed markup:

<ry>
  <accordion>
    <accordion-item title="FAQ" open>
      No ry- prefix needed inside the wrapper.
    </accordion-item>
  </accordion>
</ry>

Examples

<!-- Modal -->
<ry-button modal="demo">Open Modal</ry-button>
<ry-modal id="demo" title="Hello">Content here</ry-modal>

<!-- Drawer -->
<ry-button drawer="menu">Open</ry-button>
<ry-drawer id="menu" side="left">Menu content</ry-drawer>

<!-- Select -->
<ry-select placeholder="Country" name="country">
  <ry-option value="us">United States</ry-option>
  <ry-option value="uk">United Kingdom</ry-option>
</ry-select>

<!-- Toast (programmatic) -->
<script>
RyToast.success('Saved!');
RyToast.error('Failed');
</script>

Themes

<html data-ry-theme="dark">

Available: light, dark, ocean

CSS Architecture

ry-ui separates structure (layout/behavior) from theme (visual styling):

ry-tokens.css     # Design tokens (CSS variables)
ry-structure.css  # Pure layout - no colors, shadows, or borders
ry-theme.css      # All visual styling
ry-ui.css         # Bundled (all three combined)

Custom Themes

For completely custom styling, load only structure + your own theme:

<!-- Use default look -->
<link rel="stylesheet" href="ry-ui.css">

<!-- OR: Custom theme -->
<link rel="stylesheet" href="ry-structure.css">
<link rel="stylesheet" href="your-tokens.css">
<link rel="stylesheet" href="your-theme.css">

Structure CSS contains only:

  • Display modes, positioning, flexbox, grid
  • Sizing, padding, margins, gaps
  • State transitions (opacity, visibility, transform)

Theme CSS contains:

  • Colors, backgrounds, borders
  • Shadows, border-radius
  • Typography styling
  • Focus rings

Development

npm install
npm run dev      # Dev server with HMR
npm run build    # Production build
npm run typecheck

Publishing

nvm use 22
npm login
npm run build
git add -A && git commit -m "new build"
npm version patch  # or minor, major
npm publish --access public

Automatically available on CDN via unpkg and jsdelivr.

TypeScript Philosophy

ry-ui is written in strict TypeScript with a "vanilla-first" approach:

No Decorators, No Magic

We use plain class syntax with private fields (#field) instead of decorators. The code reads like standard JavaScript with type annotations.

// What we do
class RySelect extends RyElement {
  #highlightedIndex = -1;
  #typeahead = '';

  setup(): void { ... }
}

// What we avoid
@customElement('ry-select')
class RySelect extends LitElement {
  @property() value = '';
  @state() private _open = false;
}

Strict Mode, No Exceptions

{
  "strict": true,
  "noUncheckedIndexedAccess": true,
  "noImplicitReturns": true
}

Type Patterns

Explicit over inferred for public APIs:

get value(): string { return this.getAttribute('value') ?? ''; }
emit<T = void>(name: string, detail?: T): boolean { ... }

Union types for constrained values:

type ToastVariant = 'info' | 'success' | 'warning' | 'error';
static observedAttributes = ['value', 'disabled'] as const;

Extend globals for custom events:

declare global {
  interface HTMLElementEventMap {
    'ry:change': CustomEvent<{ value: string }>;
  }
}

Build Output

Single bundled ESM file for CDN simplicity:

dist/
├── ry-ui.js      # 32KB (7KB gzip)
├── ry-ui.js.map  # Source maps
└── ry-ui.d.ts    # Type declarations

Vite builds with esbuild for speed, Rollup for optimization, and generates .d.ts for library consumers.


See CLAUDE.md for component development guide.