Repository navigation
Your First App
Build a counter using the blinc dependency from Installation.
The UI is composed in Rust, the appearance is defined in CSS, and a Computed
keeps the displayed count bound to its Signal.
Create src/main.rs:
use blinc::{
app::windowed::{WindowedApp, WindowedContext},
cn,
layout::IntoReactive,
prelude::*,
};
fn main() -> Result<()> {
let theme = cn::cn_bundle().with_css(include_str!("app.css"));
let config = WindowConfig {
title: "Counter".into(),
width: 420,
height: 320,
..Default::default()
};
WindowedApp::run_with_theme(config, theme, ColorScheme::Dark, build_ui)
}
fn build_ui(ctx: &mut WindowedContext) -> Div {
let count = ctx.use_signal(0i32);
let displayed = computed(move |g| g.get(count).unwrap_or_default().to_string());
div().class("counter")
.child(cn::h2("Counter"))
.child(Text::bound(displayed.into_reactive()).class("counter-value"))
.child(div().class("counter-actions")
.child(counter_button(count, "Decrease", -1))
.child(counter_button(count, "Increase", 1)))
}
fn counter_button(count: Signal<i32>, label: &'static str, delta: i32) -> impl ElementBuilder {
cn::button(label).on_click(move |_| {
count.update(|value| value + delta);
})
}Create src/app.css beside main.rs:
.counter {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: var(--space-4);
background: var(--background);
}
.counter-value {
font-size: 48px;
font-weight: 700;
color: var(--primary);
}
.counter-actions {
display: flex;
gap: var(--space-2);
}cn_bundle() installs the built-in theme and component rules. The extra
stylesheet owns the application's layout and count display. Buttons retain
their themed hover, press, disabled and keyboard-focus styles.
ctx.use_signal(0i32) retains the count across UI builds. Signal is Copy,
so both event closures can capture the same handle directly.
The Computed reads the count and formats it. Text::bound subscribes to that
value; changing the count replaces the displayed text in place. There is no
stateful subtree or dependency list to rebuild for a text update.
counter_button receives the Signal and updates it in its click handler.
The component library routes pointer and keyboard activation to that handler.
Use Effects for side effects such as persistence or application integrations;
keep derived display values in Computeds.
- State Management: Signals, Computeds, Effects and property bindings.
- CSS Styling: selectors, theme variables and motion.
- Reusable Components: typed reactive props and hooks.
- Lists & Conditional Content: updates that change children.
Getting Started
Migrating
Mobile Development
Example Gallery
- Example Gallery
- Canvas Element
- Canvas Kit Interactive
- Carousel Demo - Selector API Showcase
- Chrome-Style Tabs
- blinc_cn Components
- Run with
cargo run -p blinc_app_examples --features cn --example cn_pickers_demo. - Code Element
- Complex SVG
- CSS Debug
- CSS Visual Features
- Layer Effects
- Emoji and HTML Entities
- @flow Shader
- Fluid Surface
- Skeleton animation with glTF +
blinc_canvas_kit. - Gpu Pass Demo
- Image CSS Styling
- Image Layer Test
- Keyframe Animation Canvas
- Markdown Editor
- 3D Mesh Demo — renders the Khronos glTF
DamagedHelmetsample model - Motion Demo
- Music Player Glass Card
- Node-editor demo — pre-wired graph with three node types, typed
- Notch Menu Bar
- Overflow Fade
- Overlay System
- Pointer Query
- Rich Text Element
- Rich Text Editor
- Scroll Container
- Semantic @flow
- Sortable
- Stateful API + Signal-bound modifiers demo.
- End-to-end 3D demo wiring Blinc's SceneKit3D renderer up to
- Unified Styling API
- SVG Animation
- Table Builder
- Tabler Icons
- Minimal text positioning test
- Text Input Widgets
- KHR_texture_transform
- Theme System
- Timeline Animation
- Typography
- Wet Glass
- Windowed Application
Web Development
Core Concepts
- Elements & Layout
- Styling & Materials
- CSS Styling
- Theming
- Event Handling
- Accessibility
- State Management
- Lists & Conditional Content
- Element Refs
Animation
Components
Component Library (blinc_cn)
- Overview
- Button
- Card
- Icons
- Typography
- Dialog
- Form Components
- Date, Time and Colour Pickers
- Rich Text Editor
- Code Editor
- Navigation
- Feedback
- Layout
- Data Display
Widgets
- Buttons & Inputs
- Text & Rich Text
- Code Editor
- Scroll Containers
- Virtualized List
- Canvas Drawing
- Gestures
- Notched Surfaces
- Images & SVG
- Audio & Video
- Markdown Rendering
Canvas Kit
Advanced
- Routing & Navigation
- Multi-Window
- System Integration
- Element Query API
- Overlay System
- Custom State Machines
- Pointer Query
- Performance Tips
- Flow Shaders
- 3D Rendering
- Custom GPU Passes
- Hot reloading
Architecture
Contributing