Skip to content

gersak/ty

Repository files navigation

"After playing around with Replicant, I realized I could build Web Components without React — actually, even without Replicant.

I'm wondering if it's called 'Replicant' because of Blade Runner (I love Blade Runner).

Maybe I could name my own library something similar... Tyrell? No, that feels pretentious.

Anyway, I don't really want to type something long like tyrell-button. It should be shorter — maybe ty-button.

Yes! Let's call it ty."

ty - web components in ClojureScript

jsDelivr NPM Version Bundle Size Clojars Project Clojars Project

Framework-agnostic web components built with ClojureScript. Standards-based. Designed to last. Works with React, Vue, HTMX—or no framework at all.

⚠️ Work in Progress - But Ready to Use

ty is actively being developed. Components work, examples run, but expect rough edges. This is a real project with a real vision - web components that work everywhere, built on standards that won't break next year.

Working well:

  • Button - Semantic buttons with flavors and sizes
  • Input - Enhanced inputs with validation and formatting
  • Textarea - Auto-resizing textarea
  • Calendar - Full calendar system with navigation, custom rendering, and form integration
  • Date Picker - Date selection with calendar popup
  • Dropdown - Rich dropdown with HTML content support
  • Multiselect - Multi-select with tags and search
  • Modal - Accessible modals with focus trapping
  • Popup - Positioned popovers
  • Tooltip - Smart tooltips with positioning
  • Tag - Chip/tag component with removable option
  • Icon - 8000+ icons built-in (Material, Font Awesome, Lucide, Hero)
  • Semantic design system - Automatic theming with CSS variables

Coming soon:

  • 🚧 Tabs component
  • 🚧 Better mobile adaptations
  • 🚧 More layout components
  • 🚧 Enhanced accessibility features

See it in action →

Framework Integration

React: @gersak/ty-react typeScript wrappers handle the custom events and refs. Works with React 16-19.

HTMX: Just works. Server-side rendering with dynamic interactions.

Vue/Angular: Import the components, use them. Web Components are web standards.

ClojureScript: Built-in router, i18n, and responsive layout system if you want them.

Quick Start

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gersak/ty@latest/css/ty.css">
<script src="https://cdn.jsdelivr.net/npm/@gersak/ty@latest/ty.js"></script>

<ty-button flavor="primary">Hello World</ty-button>
<ty-calendar value="2024-12-25"></ty-calendar>

See full documentation →


⚠️ Important: CSS is Required

Ty components require the ty.css stylesheet to display correctly. The CSS file contains:

  • CSS Variables - Design tokens for all colors, surfaces, spacing, and typography
  • Utility Classes - Semantic classes like .ty-bg-primary, .ty-text++, .ty-elevated
  • Theme System - Light/dark mode definitions that swap automatically
  • Component Styles - Base styling that components depend on

The Bundle Size

  • Lazy: ~89KB (50KB if you're using ClojureScript)
  • Everything: ~134KB total (GZIP)

Comparable to other component libraries, with superior tree-shaking via Google Closure Compiler.

🤝 Join the Effort

This project grows with community input. Every issue, PR, and discussion helps shape the direction.

Ways to contribute:

Especially interested in:

  • Mobile interaction improvements
  • New components
  • Real-world usage feedback
  • Documentation improvements

Links

Development

git clone https://github.com/gersak/ty.git
cd ty
npm install
npm run dev  # http://localhost:8000

Built with ClojureScript and Web Components. MIT licensed.

Work in progress. Getting better every day.

Releases

No releases published

Packages

No packages published

Languages