Split barPro
One 100 % bar split into shares: rest on a segment to widen it and read its figures, switch segments from the legend and the rest reflow, with labels inside or on leader lines.
oxyn add split-barThe preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- A single 100 % bar split into shares.
- Each segment is a full-width layer cut to its share with an animated clip-path, so reflow never touches layout and a new target retargets mid-flight.
- Resting on or arrowing onto a segment widens it by 4.5 % of the bar (or to 16 % when smaller, enough to fit its name and share) while the others give way proportionally and dim (split).
- The readout shows the highlighted segment's value and share (one decimal) or the total.
When not to use
- A launch countdown with digits that roll per unit, a compact one-line variant, hours absorbing days when days are hidden, and a live state with a pulsing dot at zero: use Countdown instead.
- A total that moves clearly: use Animated counter instead.
- A collapsible JSON tree with search, paging for long arrays, copy value or path, the current path under the tree and full keyboard moves: use JSON viewer instead.
Installation
Split bar is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add split-barUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Traffic
Six sources: small ones label below on leader lines.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Budget
Currency values.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Hidden
One segment switched off; the rest reflow.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
SplitBar
| Prop | Type | Default | Description |
|---|---|---|---|
titlerequired | String | — | Heading (and accessible name). |
description | Option<String> | Default::default() | One line under the title. |
sharesrequired | Vec<Share> | — | Shares in display order. |
unit | String | Default::default() | Word after values in the readout ("sessions"). |
prefix | String | Default::default() | Prefix on values ("$"). |
total_label | String | "Total" | Readout label with nothing highlighted. |
default_hidden | Vec<String> | Default::default() | Segments switched off at first. |
legend | bool | true | Show the legend. |
on_hidden_change | EventHandler<Vec<String>> | — | Called with the hidden ids when a segment is switched. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Tab | The bar, then each legend item |
| →or↓ and ←or↑ | Highlight the next / previous segment |
| HomeorEnd | First / last |
| EnterorSpace | Switch the highlighted segment off |
| Escape | Clear the highlight |
Accessibility
- The readout is aria-live=polite; legend items are toggle buttons with aria-pressed.
- Reduced motion swaps widths without the clip-path glide.
From the spec
- The readout is aria-live=polite; legend buttons expose aria-pressed.
Motion & interaction
Timing
- Clip-path edges 450 ms (cubic-bezier .25,1,.4,1); names open 350 ms.
- Reduced motion swaps widths without the glide.
Responsive behaviour
- Labels move outside segments narrower than about 13 % of the bar.
Edge cases (spec)
- Outside labels below segments narrower than 13 %.
Notes for AI
- Import
SplitBarfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
SplitBarElinoxyn_gpui. - Props to set first:
title,shares. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.