1# llimphi-widget-dock-rail
2
3Vertical rail of **teeth** (*dientes*) for dockable sidebars.
4
5Each tooth is a vertical tab: a 3px **accent bar** hugging the inner edge (lit
6when the item is active) plus a centred **icon**. The teeth stack into a rounded
7column painted as a strip floating at the edge of the centre — the cosmos dock
8pattern, now reusable.
9
10Render-only and `Msg`-agnostic: an item is identified by an opaque `u64`. The
11click (on *press*, so it does not fight the drag) activates through
12`on_activate(id)`; a tooth is **draggable** with its `id` as payload, and the
13whole rail is a **drop target** (`on_drop(payload)`) — so an app can move a
14tooth from one sidebar to another by dropping it on the opposite rail. The icon
15is drawn by the caller (`make_icon`), which receives the colour already resolved
16for the active/inactive state.
17
18Optionally a tooth carries a **badge** ("bubble number") on its outer corner:
19`dock_rail_view_badged` takes `make_badge(id)` returning a `DockBadge` (a chip
20with a number, or a status dot, reusing `llimphi_widget_badge`). Since it is
21derived from the `id`, changing the model and repainting is enough for the
22counter to change live.
23
24```ignore
25let items = [DockRailItem { id: 0, active: true }, DockRailItem { id: 1, active: false }];
26dock_rail_view(
27 &items,
28 44.0,
29 &DockRailPalette::from_theme(&theme),
30 |id, size, color| my_icon_view(id, size, color),
31 |id| Msg::DockActivate(side, id),
32 move |payload| Some(Msg::DockDrop(side, payload)),
33)
34```
35
36---
37
38Part of **llimphi** — see [llimphi](../../README.md).
README.md
llimphi-widget-dock-rail
Vertical rail of teeth (dientes) for dockable sidebars.
Each tooth is a vertical tab: a 3px accent bar hugging the inner edge (lit
when the item is active) plus a centred icon. The teeth stack into a rounded
column painted as a strip floating at the edge of the centre — the cosmos dock
pattern, now reusable.
Render-only and Msg-agnostic: an item is identified by an opaque u64. The
click (on press, so it does not fight the drag) activates through
on_activate(id); a tooth is draggable with its id as payload, and the
whole rail is a drop target (on_drop(payload)) — so an app can move a
tooth from one sidebar to another by dropping it on the opposite rail. The icon
is drawn by the caller (make_icon), which receives the colour already resolved
for the active/inactive state.
Optionally a tooth carries a badge ("bubble number") on its outer corner:
dock_rail_view_badged takes make_badge(id) returning a DockBadge (a chip
with a number, or a status dot, reusing llimphi_widget_badge). Since it is
derived from the id, changing the model and repainting is enough for the
counter to change live.
let items = [DockRailItem { id: 0, active: true }, DockRailItem { id: 1, active: false }];
dock_rail_view(
&items,
44.0,
&DockRailPalette::from_theme(&theme),
|id, size, color| my_icon_view(id, size, color),
|id| Msg::DockActivate(side, id),
move |payload| Some(Msg::DockDrop(side, payload)),
)
Part of llimphi — see llimphi.