playhtml  by spencerc99

Collaborative, interactive HTML elements for real-time web experiences

Created 2 years ago
278 stars

Top 93.2% on SourcePulse

GitHubView on GitHub
Project Summary

Playhtml is a lightweight (~300KB), library-agnostic JavaScript library that enables the creation of interactive and collaborative HTML elements with persistent state. It targets developers seeking to easily add shared, dynamic functionality to web pages, offering a fast and expressive way to build real-time collaborative experiences without complex framework integrations.

How It Works

The library leverages a single data- attribute to imbue HTML elements with collaborative capabilities. It supports scoped reactive data per element, page-level shared data channels, and per-user presence. Playhtml offers flexible synchronization and persistence options, ranging from local storage to real-time syncing. Its can-play system allows developers to define custom interactive behaviors using standard HTML, CSS, and JavaScript, making it highly extensible.

Quick Start & Requirements

  • Primary install / run command: Include via CDN (e.g., unpkg.com/playhtml) for vanilla HTML/JS, or use the @playhtml/react package for React-based frameworks.
  • Non-default prerequisites and dependencies: Standard web browser environment.
  • Links: Live demos are available at playhtml.fun/experiments/one/. A prompting guide for AI assistants is in docs/llm-prompting-guide.md.

Highlighted Details

  • Small Footprint: Approximately 300KB.
  • Library-Agnostic: Seamless integration with vanilla JavaScript and popular frameworks.
  • Custom Capabilities (can-play): Enables building unique interactive elements with HTML, CSS, and JS.
  • Cross-Page/Domain State: Supports sharing element state across different pages and domains.
  • Page-Level Data: createPageData() facilitates collaborative state management independent of DOM elements.
  • Presence & Cursors: Integrated real-time user presence and cursor tracking features.

Maintenance & Community

The project is in beta and active development. A Discord community is available for support and showcasing projects. Contributions are welcomed, and sponsorship/donations are encouraged to support ongoing maintenance and hosting costs.

Licensing & Compatibility

The specific open-source license is not detailed in the provided README. Compatibility is high due to its library-agnostic design.

Limitations & Caveats

The library is currently in beta. The can-mirror capability is experimental. Data is stored on a public Partykit instance without encryption, posing a security concern for sensitive data. Certain functionalities like can-move have display limitations, and specific array mutation operations are unsupported. Advanced features like value permissioning and robust data persistence options are planned for future releases.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
12
Issues (30d)
0
Star History
4 stars in the last 30 days

Explore Similar Projects

Starred by Junyang Lin Junyang Lin(Core Maintainer at Alibaba Qwen) and Eric Zhu Eric Zhu(Coauthor of AutoGen; Research Scientist at Microsoft Research).

page-agent by alibaba

10.6%
17k
GUI agent for controlling web interfaces with natural language
Created 6 months ago
Updated 1 day ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Magnus Müller Magnus Müller(Cofounder of Browser Use), and
4 more.

web-ui by browser-use

0.2%
16k
Web UI for AI browser agent
Created 1 year ago
Updated 7 months ago
Feedback? Help us improve.