Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI
---
// Blender's own components, from Python: a try-it panel (the one place the landing page
// demonstrates scrubbing, typing math like 2*pi, and Ctrl+Z), the code, and a gallery.
import { Code } from "astro-expressive-code/components";
import FeelPanel from "./FeelPanel.astro";
import Icon from "../site/Icon.astro";
import ThemedImage from "../docs/ThemedImage.astro";
import { href } from "../../lib/docs";
const code = `from blenderui.components import App, Panel, NumberSlider, VectorField, Checkbox, ColorSwatch, Button
App("Object", (420, 520),
Panel("Transform",
VectorField("Location", (0.0, 1.25, 0.0)),
NumberSlider("Scale", 1.0, min=0, max=10, on_change=print)),
Panel("Shading",
Checkbox("Shadows", True),
ColorSwatch("Color", (0.8, 0.3, 0.1, 1.0))),
Button("Apply", on_click=lambda: print("apply")),
).run()`;
const steps = [
{ keys: ["Drag"], text: "a number sideways to scrub it. Shift is finer, Ctrl snaps." },
{ keys: ["Click"], text: "a field and type 2*pi or 90/4: Blender's expression evaluator." },
{ keys: ["Ctrl", "Z"], text: "undoes it. A whole drag is one step." },
];
// Screenshot pairs in public/images/shots/ (see INDEX.md there).
const gallery = [
{ shot: "feature-color-picker", title: "Color picker", body: "HSV wheel, value strip, hex field and eyedropper" },
{ shot: "feature-menu-search", title: "Menu search", body: "Type in any menu: Blender's fuzzy search" },
{ shot: "feature-pie-menu", title: "Pie menus", body: "Choices in a ring around the pointer" },
{ shot: "feature-node-editor", title: "Node editor", body: "Typed sockets, links and header menus" },
];
---
<div class="grid lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
<div class="flex min-w-0 flex-col border-b border-border lg:border-r">
<div class="flex flex-col gap-4 border-b border-border px-5 py-6 sm:px-8">
<h3 class="text-xl font-semibold tracking-[-0.01em]">Try a Blender number field</h3>
<ol class="flex flex-col gap-2.5 text-[14.5px] leading-6 text-muted">
{
steps.map((s, i) => (
<li class="flex items-baseline gap-3">
<span class="tabular w-4 shrink-0 text-[12px] font-semibold text-link">{i + 1}</span>
<span>
{s.keys.map((k, j) => (
<>
{j > 0 && <span class="text-muted">+</span>}
<kbd class="kbd-key">{k}</kbd>
</>
))}{" "}
{s.text}
</span>
</li>
))
}
</ol>
</div>
<div class="components-stage flex flex-1 items-center justify-center px-4 py-10 sm:px-10 sm:py-14">
<FeelPanel />
</div>
<p class="flex items-center gap-2 border-t border-border px-5 py-2.5 text-xs leading-5 text-muted sm:px-8">
<Icon name="info" size={14} />
A browser sketch of the feel. In BUI these widgets are native, drawn by the C kit.
</p>
</div>
<div class="flex min-w-0 flex-col border-b border-border">
<div class="flex flex-col gap-2 px-5 pt-6 sm:px-8">
<h3 class="text-xl font-semibold tracking-[-0.01em]">45 widgets and editors, from Python</h3>
<p class="max-w-[60ch] text-[15px] leading-7 text-muted">
Panels, number sliders, the color picker, pie menus, tree views and a node editor: Blender's own, ported from{" "}
<code class="font-mono text-[0.88em]">interface_widgets.cc</code>.
</p>
</div>
<div class="px-5 pt-5 sm:px-8">
<Code code={code} lang="py" title="object.py" />
</div>
<div class="components-shot hatch mt-6 flex flex-1 items-center justify-center border-t border-border px-5 py-8 sm:px-8">
<ThemedImage
shot="python-components"
fallback="images/components.png"
alt="Blender components from Python: a Render Properties editor with panels, sub-panels with header checkboxes, number fields, sliders, dropdowns, a color swatch and a progress bar"
class="img-outline h-auto max-h-[460px] w-auto max-w-full shadow-(--shadow)"
/>
</div>
</div>
</div>
<ul class="grid grid-cols-2 gap-px bg-border lg:grid-cols-4">
{
gallery.map((g, i) => (
<li class="bg-background" data-reveal style={`--reveal-i:${i}`}>
<a href={href("docs/python/components-reference/")} class="group flex h-full flex-col">
<div class="components-tile hatch flex h-56 items-center justify-center overflow-hidden border-b border-border p-4 sm:h-64">
<ThemedImage
shot={g.shot}
fallback={`images/shots/${g.shot}-dark.png`}
alt={`${g.title}: ${g.body}`}
class="img-outline h-auto max-h-full w-auto max-w-full object-contain shadow-(--shadow) transition-transform duration-500 ease-(--ease-out) group-hover:scale-[1.03]"
/>
</div>
<div class="flex items-start justify-between gap-3 p-4 sm:p-5">
<span class="flex flex-col gap-0.5">
<span class="font-semibold group-hover:text-link">{g.title}</span>
<span class="text-[13px] leading-5 text-muted">{g.body}</span>
</span>
<Icon name="arrow-right" size={16} class="mt-1 text-muted transition-transform duration-200 group-hover:translate-x-0.5 group-hover:text-link" />
</div>
</a>
</li>
))
}
</ul>
<style>
.components-stage {
background-color: var(--bl-stage);
background-image: repeating-linear-gradient(135deg, var(--bl-stage-hatch) 0 1px, transparent 1px 7px);
}
.components-shot,
.components-tile {
background-color: var(--stage);
}
.kbd-key {
display: inline-block;
min-width: 1.4em;
margin: 0 0.1em;
padding: 0 0.4em;
font-family: var(--font-sans);
font-size: 0.8em;
font-weight: 500;
line-height: 1.6;
text-align: center;
color: var(--foreground);
background: var(--surface);
border: 1px solid var(--border);
border-bottom-width: 2px;
}
</style>