Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
O

omi

> 前端框架
Open source

Web Components Framework - Web组件框架

13.3K stars0 likes3 views
WebsiteGitHub

About

Web Components Framework - Web组件框架

English | 简体中文

Omi - Web Components Framework

  • 📶 Signal-driven reactive programming by reactive-signal
  • 🧱 TDesign Web Components & OMI Playground
  • 💗 100+ OMI Templates & OMI Templates Source Code
  • 🐲 OMI Form & OMI Form Playground & Lucide Omi Icons
  • ⚡ Tiny size, Fast performance
  • 🌐 Everything you need: Web Components, JSX, Function Components, Router, Suspense, Directive, Tailwindcss...
  • 💒 Harness Constructable Stylesheets to easily manage and share styles
typescript
import { render, signal, tag, Component, h } from 'omi'

const count = signal(0)

function add() {
  count.value++
}

function sub() {
  count.value--
}

@tag('counter-demo')
export class CounterDemo extends Component {
  static css = 'span { color: red; }'

  render() {
    return (
      <>
        <button onClick={sub}>-</button>
        <span>{count.value}</span>
        <button onClick={add}>+</button>
      </>
    )
  }
}

Use this component:

typescript
import { h } from 'omi'
import './counter-demo'

render(<counter-demo />, document.body)

// or 
import { CounterDemo, Other } from './counter-demo'
// Prevent tree Shaking when importing other things
render(<CounterDemo />, document.body)

// or
document.body.appendChild(document.createElement('counter-demo'))

Install

bash
npm i omi

To quickly create an Omi + Vite + TS/JS project:

bash
$ npx omi-cli init my-app    # or create js project by: npx omi-cli init-js my-app
$ cd my-app           
$ npm start           # develop
$ npm run build       # release

To quickly create an Omi + Router + Signal + Suspense + Tailwindcss + Vite + TS project:

bash
$ npx omi-cli init-spa my-app  
$ cd my-app           
$ npm start           # develop
$ npm run build       # release

Packages

  • Core packages
    • omi - Implementation of omi framework.
    • omi-form - Powerful, simple and cross frameworks form solution.
    • lucide-omi - Lucide icon collection for omi.
    • omiu - Hope to create the best web components. For example, the powerful vchart and vtable
    • omi-router - Create SPA of omi framework.
    • omi-cli - To quickly create an Omi + Vite + TS/JS project.
  • Starter kits (not published to npm)
    • omi-elements - Tailwind Element Omi UI KIT.
    • omi-starter-spa - A starter repo for building single page app using Omi + OmiRouter + Tailwindcss + TypeScript + Vite + Prettier.
    • omi-starter-ts - A starter repo for building web app or reusable components using Omi in TypeScript base on Vite.
    • omi-starter-tailwind - A starter repo for building web app or reusable components using Omi + Tailwindcss + TypeScript + Vite.
    • omi-starter-js - A starter repo for building web app or reusable components using Omi in JavaScript base on Vite.
    • omi-vue - Vue SFC + Vite + OMI + OMI-WeUI.
  • Components
    • omi-weui - WeUI Components of omi.
    • omi-auto-animate - Omi version of @formkit/auto-animate.
    • omi-suspense - Handling asynchronous dependencies.
  • Directives
    • omi-transition - Applying animations when an component is entering and leaving the DOM.
    • omi-ripple - A lightweight component for adding ripple effects to user interface elements.
  • Examples (not published to npm)
    • snake-game-2tier - SNake Game with Signal class
    • snake-game-3tier - SNake Game with reactivity functions
    • omi-tutorial - Source code of omi tutorial.

If you want to help the project grow, start by simply sharing it with your peers!

  • Share via Dev.to
  • Share via Twitter
  • Share via Facebook
  • Share via LinkedIn
  • Share via Pinterest
  • Share via Reddit
  • Share via StumbleUpon
  • Share via Vkontakte
  • Share via Weibo
  • Share via Hackernews

Thank you!

Usage

TodoApp with reactivity functions

Data oriented programming

In data-oriented programming, the focus is on the data itself and the operations on the data, rather than the objects or data structures that hold the data. This programming paradigm emphasizes the change and flow of data, and how to respond to these changes. The TodoApp with reactivity functions is a good example of this, using the concepts of reactive programming, where the UI automatically updates to reflect changes in the data (i.e., the to-do list).

…

Auto Import h

vite.config.js:

typescript
import { defineConfig } from 'vite'

export default defineConfig({
  esbuild: {
    jsxInject: "import { h } from 'omi'",
    jsxFactory: "h",
    jsxFragment: "h.f"
  }
})

You can inject code during construction, so you don't have to manually export h.

Define Cross Framework Component

The case of using Omi component in Vue is as follows:

my-counter.tsx:

…

Using in Vue3

xml
<script setup>
import { ref } from 'vue'
// import omi component
import './my-counter'

defineProps({
  msg: String,
})

const count = ref(0)

const change = (e) => {
  count.value = e.detail
}

</script>

<template>
  <h1>{{ msg }}</h1>

  <my-counter @change="change" :count="count" />
  <p>
    【Omi】 
  </p>

  

</template>

If you fire the count-change in an Omi component:

typescript
this.fire('count-change', this.state.count)

To use the component and listen for events in Vue:

xml
<my-counter @count-change="change" :count="count" />

Using in React

…

Contributors

License

MIT © Tencent

Issues· 68 open

View all issuesOpen on GitHub
  • #997

    omi-vueify包的chatbot组件里slot发生变更时不会触发webc父组件的更新

    Updated Jun 12, 2026
  • #964

    补充 omi-reactify 封装 omi tree组件实现 react 组件

    犀牛鸟开源人才专属Updated Dec 30, 2025
  • #961

    补充 omi 单元测试(任意子模块)

    犀牛鸟开源人才专属Updated Jul 30, 2025
  • #962

    升级omi cli的模板的Vite为最新版本

    犀牛鸟开源人才专属Updated Jul 30, 2025
  • #960

    补充 reactive-signal 单元测试

    犀牛鸟开源人才专属Updated Jul 23, 2025
  • #958

    omi-templates vite升到 v7

    犀牛鸟开源人才专属Updated Jul 15, 2025
  • #957

    补充 omi-vueify 单元测试

    犀牛鸟开源人才专属Updated Jul 13, 2025
  • #945

    传入类型是HTMLCollection,要如何解析到Omi里面?

    Updated Feb 28, 2025
  • #942

    OMI接收不了Vue传过来的方法

    Updated Jan 16, 2025
  • #941

    希望自定义事件可以支持携带:

    Updated Jan 16, 2025

> Tags

TypeScriptcomponentscsscustom-elementshtml

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 28, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架