CrychicUI

module
v0.0.0-...-1c55e6a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: MIT

README

CrychicUI

Listed on Awesome MyGo

MyGo 原生 UI 的 Go 组件库:1501 个组件,分 39 类,每类一个包。沿用 MyGo 自己的外观:锌灰底色,跟随系统的强调色,6 DIP 圆角,4 DIP 间距单位,系统字体。每个组件都会动,每个可交互组件都有合成音效。

界面由 MyGo 在 GPU 上自绘,不用 HTML、JavaScript 或 WebView。

安装

go get github.com/ELY-Open-Source/CrychicUI

要求 Go 1.27.3 与 MyGo v0.8.3。

使用

组件是函数:第一个参数是 *ui.Context,返回 ui.Element;可选项放在最后的 NameOptions 里。容器把内容作为最后一个 func(),放在选项之后。有多个动作的组件返回多个命名的 ui.Element,root 在前,例如 button.SplitButton。

import (
	"github.com/ELY-Open-Source/CrychicUI/button"
	"github.com/egoist/mygo/ui"
)

func view(c *ui.Context) {
	if button.Solid(c, "Save").Clicked() {
		save() // 按钮已经播放了自己的音效
	}
}

分类

类 包 数量
Layout layout 50
Typography typography 40
Button button 45
Display display 55
Input input 55
Choice choice 50
Feedback feedback 55
Motion motion 55
Effects fx 45
Form form 40
Date & Time datetime 45
Color color 20
Navigation navigation 55
Overlay overlay 45
Data data 55
Chart chart 60
Media media 45
Chat chat 45
Agent agent 40
Code code 40
Files files 35
Shop shop 40
Finance finance 40
Dashboard dashboard 35
Schedule schedule 30
Project project 40
Mail mail 30
Social social 35
Account account 40
Devtools devtools 35
Game game 30
Learn learn 20
Health health 20
Home home 20
Marketing marketing 40
Content content 25
Desktop desktop 30
Geo geo 15
Diagram diagram 1

sound、icon、kit 是组件共用的底层包。

Mermaid 图

diagram.Mermaid 把 Mermaid 源码画成主题色的图:流程图、时序图、饼图等 33 种。图按自身尺寸显示,容器窄时等比缩小;源码有错时显示 Pele 的报错和行列号。

diagram.Mermaid(c, "flowchart LR\n  Wedge[Wedge clay] --> Throw[Throw]", diagram.MermaidOptions{})

引擎是 pele-go(Pele 的 Go 移植,MIT)。只有导入 diagram 的程序才链接它,体积增加约 6 MB。链接、远程图片和数学公式不绘制。

音效

可交互组件在动作时播放一个音效,默认开启。音效在 sound 包里合成,不读音频文件。

sound.SetEnabled(false) // 全部静音
sound.SetVolume(0.5)
go run ./cmd/gallery

同一个程序编译成 WebAssembly,就是网站:https://crychicui.zhangyanghaha0407.workers.dev

检查

go vet ./... && go tool mygo vet . && go test ./...
GOOS=js GOARCH=wasm go vet ./...
cd web && npm install && npm test   # 构建 web/dist,Playwright 本地跑

网站检查需要 Node 22+(Wrangler 的要求)、PATH 里的 python3(本地测试服务器),以及一次 npx playwright install chromium。

npm run deploy(在 web/ 里)先在预览地址测试新版,再切到线上并重测。

许可

MIT。第三方声明见 THIRD_PARTY_NOTICES.md。

Directories

Path Synopsis
Package account holds account and billing components.
Package account holds account and billing components.
Package agent holds prompt, run and answer components.
Package agent holds prompt, run and answer components.
Package chart draws data with MyGo's ui/chart.
Package chart draws data with MyGo's ui/chart.
Package chat holds message bubbles, lists and composers.
Package chat holds message bubbles, lists and composers.
cmd
gallery command
Command gallery opens the CrychicUI gallery on desktops and browsers.
Command gallery opens the CrychicUI gallery on desktops and browsers.
Package code holds code viewing and tooling components.
Package code holds code viewing and tooling components.
Package color holds components that choose and inspect colors.
Package color holds components that choose and inspect colors.
Package content holds documentation and reading components.
Package content holds documentation and reading components.
Package dashboard holds analytics components.
Package dashboard holds analytics components.
Package data holds tables, lists, trees and queries.
Package data holds tables, lists, trees and queries.
Package datetime holds date, time and clock components.
Package datetime holds date, time and clock components.
Package desktop holds desktop shell and window components.
Package desktop holds desktop shell and window components.
Package devtools holds developer and operations components.
Package devtools holds developer and operations components.
Package feedback holds alerts, progress, loaders and states.
Package feedback holds alerts, progress, loaders and states.
Package files holds file management components.
Package files holds file management components.
Package finance holds money and market components.
Package finance holds money and market components.
Package form holds form layouts, fields and whole forms.
Package form holds form layouts, fields and whole forms.
Package fx holds backdrops, particles, borders and text fills.
Package fx holds backdrops, particles, borders and text fills.
Package gallery shows every component live.
Package gallery shows every component live.
Package game holds game interface components.
Package game holds game interface components.
Package geo holds map, place and location components.
Package geo holds map, place and location components.
Package health holds health and fitness components.
Package health holds health and fitness components.
Package home holds smart home components.
Package home holds smart home components.
Package icon embeds the Lucide icons, parsed on first use.
Package icon embeds the Lucide icons, parsed on first use.
Package kit holds helpers three or more components share.
Package kit holds helpers three or more components share.
Package layout arranges other elements.
Package layout arranges other elements.
Package learn holds learning and study components.
Package learn holds learning and study components.
Package mail holds mail and communication components.
Package mail holds mail and communication components.
Package marketing holds landing page components.
Package marketing holds landing page components.
Package media holds image, audio and player components.
Package media holds image, audio and player components.
Package motion holds entrances, text effects, loops and pointer motion.
Package motion holds entrances, text effects, loops and pointer motion.
Package navigation holds bars, tabs, menus and paths.
Package navigation holds bars, tabs, menus and paths.
Package overlay holds dialogs, sheets, popovers and menus.
Package overlay holds dialogs, sheets, popovers and menus.
Package project holds task management components.
Package project holds task management components.
Package schedule holds calendar components.
Package schedule holds calendar components.
Package shop holds storefront components.
Package shop holds storefront components.
Package social holds social networking components.
Package social holds social networking components.
Package sound plays the cues components make.
Package sound plays the cues components make.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL