41 releases
Uses new Rust 2024
| 0.4.5 | Mar 15, 2026 |
|---|---|
| 0.4.4 | Mar 14, 2026 |
| 0.3.23 | Mar 11, 2026 |
| 0.3.4 | Feb 28, 2026 |
| 0.1.2 | Feb 22, 2026 |
#96 in Text editors
10MB
43K
SLoC
Woocraft
Woocraft is a Rust component library built on top of GPUI.
This repository is organized as a Cargo workspace, with the main maintained crate at crates/woocraft.
[!WARNING]
this crate is in early work-in-progress state.
most of components come from longbridge/gpui-component and components in zed editor, with some visual fixes / improvements.
it may lacks of feature.
Features
- Composable UI components powered by GPUI
- Built-in theme system (Light / Dark)
- Optional embedded icon and font assets
- Built-in internationalization (i18n)
- Multiple runnable examples
Component Overview
woocraft currently exports the following components/modules:
- Core primitives: Theme, Icon, style extensions, IndexPath, Anchor
- Common widgets: Button, Input, Checkbox, Switch, Slider, Spinner, Tag
- Navigation/info: Breadcrumb, Pagination, Tooltip, Popover, Notification
- Layout/structure: Divider, TitleBar, WindowBorder, WidgetGroup
- Advanced widgets: List, VirtualList, Menu, Progress
For exact exports, see
crates/woocraft/src/widgets/mod.rsandcrates/woocraft/src/base/mod.rs.
Requirements
- Rust
1.93.0or newer
Installation
on crates.io:
[dependencies]
woocraft = "0.1"
To use directly from this repository:
[dependencies]
woocraft = { git = "https://github.com/Reverier-Xu/woocraft", package = "woocraft" }
Quick Start
use gpui::{App, Application};
fn main() {
// With the default `resources` feature enabled, built-in assets (icons/fonts) can be injected.
let app = Application::new().with_assets(woocraft::Assets);
app.run(|cx: &mut App| {
woocraft::init(cx);
// Create and open your windows/components here.
});
}
woocraft::init(cx) will:
- Initialize i18n
- Register global actions
- Initialize base theme/style state
- Initialize component-level features (such as input/list/menu)
Run Examples
Run from the repository root:
cargo run -p woocraft --example button
cargo run -p woocraft --example controls
cargo run -p woocraft --example menu
cargo run -p woocraft --example pagination
Example sources are located in crates/woocraft/examples/.
Internationalization (i18n)
Built-in locales:
zh-hanszh-hanten-usja-jp
By default, locale is detected from LC_ALL / LANG and normalized to one of the supported values above.
You can also switch locale at runtime:
woocraft::set_locale("zh-CN");
let current = woocraft::locale();
Load custom locale data and extend existing translations at runtime:
use std::collections::HashMap;
let mut custom = HashMap::new();
custom.insert("title_bar.untitled".into(), "Sans titre".into());
woocraft::load_locale("fr-fr", custom);
woocraft::extend_locale(
"en-us",
[("title_bar.untitled", "Untitled Window")],
);
Translation interfaces from rust-i18n are re-exported (for example woocraft::translate()).
Feature Flags
resources(enabled by default):- Enables
rust-embed - Exposes
woocraft::Assets - Automatically registers embedded fonts (inside
woocraft::init)
- Enables
Disable default features:
[dependencies]
woocraft = { version = "0.1.0", default-features = false }
Repository Layout
.
├─ crates/
│ └─ woocraft/ # Main crate
├─ packages/
│ └─ woocraft/ # npm package metadata (version alignment)
└─ deprecated/ # Legacy/migrating code
├─ ui/
├─ story/
├─ assets/
├─ webview/
├─ reqwest_client/
└─ macros/
Development
cargo fmt --all
cargo clippy --workspace --all-targets
cargo test --workspace
License
Copyright 2026 Reverier-Xu.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Dependencies
~55–235MB
~5.5M SLoC