git404hub

what is bento fr?

tcantenot/bento — explained in plain English

Analysis updated 2026-05-18

17CAudience · developerComplexity · 3/5Setup · easy

tl;dr

A single-header C99 library that arranges UI rectangles using a Flexbox-style layout tree, with grow and shrink weights and draggable splitters.

vibe map

mindmap
  root((bento))
    Inputs
      Element tree
      Grow shrink weights
      Splitter mouse drags
    Outputs
      Computed positions
      Computed sizes
      Splitter state
    Use Cases
      Tool UI layout
      Game editor panels
      Custom immediate UI
    Tech Stack
      C99
      Single header
      No allocator

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Lay out panels and buttons in a custom C or C++ game tool without pulling in a UI framework

VIBE 2

Add draggable splitters between panels in an existing immediate-mode UI

VIBE 3

Compose fixed, percentage, and auto-sized children with grow and shrink overflow handling

VIBE 4

Embed Flexbox-style layout in a memory-constrained app with no runtime allocations

what's the stack?

CC99

how it stacks up fr

tcantenot/bento0xblackash/cve-2026-46333atomiczsec/noradrenaline
Stars171717
LanguageCCC
Setup difficultyeasymoderatehard
Complexity3/54/54/5
Audiencedeveloperresearcherops devops

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · easy time til it works · 30min

No text rendering or scrolling, so you must pair it with your own renderer and input loop.

in plain english

Bento is a small C library for arranging boxes on a screen using the Flexbox layout idea borrowed from web browsers. Flexbox is a way of describing how rectangles stack and resize next to each other, growing or shrinking to fit the space available. The whole library lives in one header file written in C99, which means a developer drops a single file into their project to get layout behavior for buttons, panels, and other rectangular UI parts. The author cites Nic Barker's Clay library as the main inspiration but lists clear differences. What Bento does not try to do is spelled out plainly. There is no text rendering, no animation system, and no scrolling containers. It does not allocate memory at runtime, so a maximum element count is set at compile time. What it does add on top of the Clay model is grow and shrink weights for handling under and overflow, plus resizing splitters that the user can drag with a mouse to change the size of neighbouring panels. The layout works as a tree of elements. Each element has a position and a size that the library computes when you call bt_compute_layout. Elements can be sized in three ways: automatic (wrapping their children), fixed in pixels, or as a percentage of the parent. When children together ask for less space than the parent has, the leftover is shared among elements that have a grow weight. When they ask for more, the excess is taken from elements that have a shrink weight. Optional min and max clamps cap the result. To use Bento, the developer declares a static array of element nodes, builds the tree once with nested begin and end calls, and then calls the compute function every frame to refresh positions. Splitter helpers handle mouse drags and report whether a splitter is blocked when both neighbours have hit their size limits.

prompts (copy fr)

prompt 1
Drop bento.h into my C project and lay out a sidebar plus main panel with a draggable splitter
prompt 2
Show me a bento element tree with one fixed header, a flexible body, and a percentage-sized footer
prompt 3
Set the compile-time max element count for bento and explain how memory is reserved
prompt 4
Wire bento's splitter helper to my mouse input loop and detect when a splitter is blocked
prompt 5
Compare bento to Nic Barker's Clay library for a small C-based tool UI

Frequently asked questions

what is bento fr?

A single-header C99 library that arranges UI rectangles using a Flexbox-style layout tree, with grow and shrink weights and draggable splitters.

What language is bento written in?

Mainly C. The stack also includes C, C99.

How hard is bento to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is bento for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.