Expand description
The DOM widget catalog (CSS-styled controls, select popover, chat blocks).
The DOM widget catalog: ready-made El trees for the common controls and chat
building blocks, styled by KIT_CSS (every look is a CSS rule an app may override
by appending its own sheet, see sheet_with).
| widget | builder | element / classes | hit ids |
|---|---|---|---|
| button | button | button.k-btn (.primary, .ghost) | id |
| switch | switch | button.k-switch + Control::Switch (:checked) | id |
| checkbox | checkbox | div.k-check > span.k-box + Control::Checkbox | id |
| text input | input | div.k-input + Control::Input (:focus) | id |
| number field | number_input + NumberSpec | div.k-num > div.k-input, div.k-steps > button.k-step | id, {id}:inc, {id}:dec |
| spinner | spinner | span.k-spinner + Control::Spinner | — |
| select trigger | select_trigger | select.k-select (.open) | id |
| select popover | select_popover | fixed div.k-pop > div.k-opt (.sel, .dis) > label + div.k-sub | {id}:opt:{i} (enabled rows only) |
| message bubble | bubble | div.k-msg.me / .them > div.k-who, div.k-body (runs), div.k-time | id |
| hover action row | action_row | div.k-actions > button.k-act | {id}:{key} |
| collapsible card | card | div.k-card (.open) > div.k-card-head + div.k-card-body | id (the head) |
| chip / filter | chip | button.k-chip (.on) | id |
| banner | banner | div.k-banner.info / .warn / .error | {id}:act, {id}:close |
| side panel | side_panel | fixed div.k-side > div.k-side-head + div.k-side-body | {id}:close |
| tabs | tabs | div.k-tabs > button.k-tab (.on) | {id}:tab:{i} |
| segmented | segmented | div.k-seg > button.k-seg-btn (.on) | {id}:{i} |
| list | list | div.k-list > div.k-li (.sel) | {id}:row:{i} |
| radio group | radio_group | div.k-radio-group > div.k-radio (.sel) > ring + dot | {id}:{key} |
| table | table | div.k-table > grid div.k-tr (.k-th, .sel) > div.k-td (.num) | {id}:row:{i} |
| menu | menu | fixed div.k-menu > div.k-mi (.danger, .dis), div.k-sep | {id}:item:{i} |
| dialog | dialog | fixed div.k-scrim + div.k-dialog > head, body, foot | {id}:scrim, {id}:close, {id}:foot:{i} |
| tooltip | tooltip | fixed div.k-tip | — |
| toasts | toasts | fixed div.k-toasts > div.k-toast (.ok, .warn, .error) | {id}:{i}:close |
toolbar (opt-in TOOLBAR_CSS) | toolbar + ToolItem | div.k-toolbar (.vert) > button.k-tool (.on, .dis) > span.k-tool-icon, div.k-tool-split > button.k-tool-chev, div.k-tool-sep, div.k-tool-fill | {id}:{key}, {id}:{key}:menu |
| flyout | menu at flyout_at | fixed div.k-menu beside its tool | {id}:item:{i} |
| stat, progress, badge, kbd, field | stat, progress, badge, kbd, field | div.k-stat, div.k-progress, span.k-badge, span.k-kbd, div.k-field | id (stat) |
The light look is LIGHT_VARS on the page root (theme_vars); every colour in
KIT_CSS is a --k-* variable.
Inline markdown for bubbles is inline_md; long lists render only their visible
rows with VirtualList. Kit widgets from uzor-framework go inside a DOM tree
through an embed slot (El::slot + Dom::slots); a
DOM tree goes inside a kit panel by laying it out in the panel’s rect.
Modules§
- icons
- Icon bodies used by the catalog.
Structs§
- List
View - What part of a long option list a popover shows. The select’s own model (keyboard, wheel, type-to-filter) keeps it; the popover only draws it.
- Menu
Item - One entry of a
menu. - Number
Spec - The rules of a number field (
number_input): range, step, shown decimals. The value stays text while it is typed (-,1.and an empty field are fine); the app reads it withNumberSpec::parse, the steppers and the arrow keys go throughNumberSpec::stepped, and leaving the field tidies it withNumberSpec::normalized(uzor-framework’skit::domdoes all three). - Select
Opt - One option of a select.
- Tool
Item - One toolbar entry (
toolbar). - Virtual
List - A virtualized list: only the rows in (or near) the viewport are built and laid out;
spacers stand for the rest. Row heights start at an estimate and are learned from
laid-out rows (
VirtualList::measure), so long chats stay cheap. - Window
- The rows a
VirtualListshows and the space around them.
Enums§
- Tool
Kind - What a toolbar entry is.
Constants§
- KIT_CSS
- The catalog’s default look (dark, 13px Inter). Variables on
:roottheme it:--k-accent,--k-bg,--k-fg,--k-muted,--k-line,--k-panel. - KIT_
TOUCH_ CSS - Touch-sized targets, applied under
@media (pointer: coarse)(a finger: iOS / Android builds, or the last input was touch). Apple asks for 44 pt, Material for 48 dp: controls grow to 44 px, list rows to 48 px, text to 15 px. The look stays the same; only sizes change.sheetandsheet_withinclude it afterKIT_CSS; the app’s own rules still win. - LIGHT_
VARS - Inline
:rootoverrides for the light look: put them on the page root (El::new("div.k-root").css(LIGHT_VARS)); custom properties cascade to the subtree. - TOOLBAR_
CSS - The toolbar’s look, opt-in (not in
KIT_CSS, so apps without a toolbar do not carry it): append it withsheet_with(sheet_with(TOOLBAR_CSS), or after the app’s own rules to let them win).
Functions§
- action_
row - A hover action row (reply, react, copy, more…):
(key, icon body, name)per button, hits{id}:{key}. - badge
- A small status pill (
kind:"",ok,warn,error,muted). - banner
- A banner (
kind:info,warn,error) with an optional action button ({id}:act) and a close button ({id}:close). - bubble
- A chat message bubble: optional sender line, markdown body (
inline_md), time. - button
- A push button.
- card
- A collapsible card: the head (hit
id) togglesopen; the body shows when open. - centered
- A
w × hbox centred inviewport(where adialoggoes). - checkbox
- A checkbox with its label; the row is the hit.
- chip
- A filter chip.
- chips_
input - A chips input (G11): removable tokens (
{id}:rm:{i}) plus a trailing field hit{id}:fieldthe app focuses for typing.picked_chip_removereads the index. - combo
- A searchable combobox (G5): trigger hit
{id}:trigger; whenopen, a popover with a query field{id}:queryand option hits{id}:opt:{i}(already filtered by the app). The app owns open / query state and re-renders. - data_
table - A data table (G7): sticky header with per-column sort hits
{id}:sort:{i}and row hits{id}:row:{i}.sort= (column, ascending) draws the arrow. - dialog
- A modal dialog at
atover a full-viewport scrim ({id}:scrim, a hit so a click outside can close it), with a title, a close button ({id}:close),bodyand footer buttons{id}:foot:{i}(the first is.primary). - field
- A labelled form row: a small caption above
control. - flyout_
at - Where a tool’s flyout goes: beside the tool
anchor(to its right on a vertical toolbar, below it on a horizontal one, 4 px off),w×h, kept insideviewport. - grid_
presets - A docking / layout preset picker (G14): one button per preset, hit
{id}:{key}, the active one carries.on. - icon
- A 24×24 stroke icon (
currentColor) from its path markup. - inline_
md - Inline markdown to DOM runs:
**bold**,*italic*/_italic_,***both***,`code`(verbatim), http(s) links (a.link, hiturl:…) and@nickmentions (a.mention, hitnick:…). Unclosed markers stay literal;_only opens at a word start and closes at a word end (snake_casestays as is). - input
- A single-line text input showing
edit. - kbd
- A keyboard shortcut hint (
span.k-kbd). - list
- A list of rows (
div.k-li,.selforselected), each a main label and an optional muted side text; hits{id}:row:{i}. - menu
- A context menu / command list as a
position: fixedbox atat(viewport coordinates; seepopover_at). Enabled items are hits{id}:item:{i}(icounts separators too, so it is the index intoitems). - menu_
with_ open menuwith rowopen_subcarrying.openso its nested submenu (G12) shows. Submenu items are hits{id}:sub:{i}:{j}.- number_
input - A number field: a text input (
id) with up / down steppers ({id}:inc,{id}:dec). The rules are aNumberSpec; in uzor-framework register them withkit::dom(..).number(id, spec), which filters typing, steps on the buttons, the arrow keys and the wheel over the focused field, and tidies the text on blur. - picked
- The tab, segment, row or item index a hit id names (
{id}:{kind}:{i}, or{id}:{i}for an emptykind). - picked_
chip_ remove - The index of a chip remove hit (
{id}:rm:{i}), ifhitis one of this input’s tokens. - picked_
opt - The option index a select popover hit id names (
{id}:opt:{i}). - picked_
radio - The key of a radio row hit (
{id}:{key}), ifhitis one of this group’s rows. - picked_
reorder - The index of a reorder handle hit (
{id}:drag:{i}). - picked_
swatch - The index of a swatch hit (
{id}:{i}), ifhitis one of this grid’s cells. - picked_
tool - The tool a toolbar hit names:
(key, false)for the button,(key, true)for its flyout chevron. - popover_
at - Where a popover
htall goes for a trigger atanchorinviewport: below it, or above when it does not fit below and fits better above; at least the trigger’s width. - progress
- A progress bar,
vin 0 … 1. - radio_
group - A radio group: one choice of many, compact 32 px rows 4 px apart (the mlc
language-picker metrics: 15.5 px ring with a 1.5 px border, an 8 px dot when
on, a 13 px label at x=30). Each row is a hit
{id}:{key}; the selected row carries.sel(accent ring + dot). The hover highlight isdiv.k-radio:hover— set--k-hover: transparentto turn it off. - range2
- A two-thumb range slider (G3 dual): fills between
loandhi. Hits{id}:track,{id}:lo,{id}:hi; the app decides which thumb a drag moves. - reorder_
handle - A drag handle for row / tab reordering (G8): hit
{id}:drag:{i}; the app owns the drag (pointer capture) and reorders its own model. - segmented
- A segmented control (one choice of a few, e.g. Dark / Light): hits
{id}:{i}. - select_
list select_popoverfor a windowed, searchable list: rowsview.top ..ofopts(the already filtered options; hits keep their index inopts), the highlighted row, a search line and a scroll thumb. “No matches” whenoptsis empty. The popover isposition: fixedatat, soatis in the coordinates of the viewport given tolay_out_in(the window, origin 0,0). Its rows’--k-accent(the chosen row’s tick) can be set inline on the returned element.- select_
popover - The open select’s list as a
position: fixedpopover atat(seepopover_at): it paints above the page and does not scroll with it. Enabled rows are hits{id}:opt:{i};chosenis marked.sel(with a tick). - select_
trigger - The closed select: the chosen label and a chevron.
- selectable_
text - Read-only text the user can select / copy (G10). Selection is the DOM’s own
text selection; the box is a hit
{id}so the app can focus it. - sheet
KIT_CSS(plusKIT_TOUCH_CSS) parsed against the current media environment.- sheet_
with KIT_CSSfollowed by the app’s own rules (later rules of equal specificity win).- side_
panel - A side panel docked right (
position: fixed: it stays while the page scrolls), with a title row and a close button ({id}:close). - slider
- A horizontal slider of explicit pixel width
w(G3): a 4 px track, an accent fill up tovalue, and a 14 px thumb. Hits:{id}:trackand{id}:thumb; map a pointer x back withslider_value. The thumb/track are hits so the app owns the drag (pointer capture) and re-renders with the new value. - slider_
fraction - Normalised position of
valuein[min, max], clamped to 0..=1. - slider_
value - Map a pointer x (relative to the slider’s left edge, width
w) to a value. - slot
- An embed slot box (
div.k-slot) namedkey,w×h: a kit widget or canvas goes in its content box (seeDom::slots). - spinner
- A busy spinner at time
tseconds. - stat
- A metric tile: a caption, a big value and a muted note.
- swatches
- A wrapping grid of colour swatches (G4 L1). Each cell is a hit
{id}:{i}; the selected cell carries.sel(accent border).picked_swatchreads the index back from a hit. - switch
- A switch (
role="switch"): the track is the button’s box, the knob its control. - switch_
at - A switch whose knob is at
pos(0 … 1) while it slides. - table
- A table: a header row and data rows on one CSS grid track list (
columns, e.g."1fr 80px");numcolumns align right. Rows are hits{id}:row:{i},.selforselected. - tabs
- A tab strip: one
button.k-tabper label (.onforactive), hits{id}:tab:{i}. - theme_
vars - The page-root inline variables for the dark (
"", the sheet’s own:root) or light look. - toasts
- A toast stack in the bottom-right corner of the viewport:
(kind, text)per toast (kindas forbanner); each has a close hit{id}:{i}:close. - toolbar
- A toolbar (style it with
TOOLBAR_CSS): a row, or a column whenvertical, ofToolItems. Hits{id}:{key}per enabled button,{id}:{key}:menuper split chevron (open its flyout withmenuatflyout_at);picked_toolreads them. - tooltip
- A tooltip below
anchor(fixed, viewport coordinates).