# Admin UI

https://docs.kleaver.ie/components/admin-ui/

The pieces the owner portal is built from, for any screen where someone edits data. They sit on the framework's own form controls (.field, .input, .choice, .btn, .modal); only what was missing was added. All text is set with textContent by [the portal's script](modules.html#owner-portal); nothing from a server is read as markup.

```
.portal        page: .portal__bar, .portal__cards > .portal__card, .portal__help, .portal__meta
.listedit      rows: .listedit__row > .listedit__title, __fields, __times, __actions
.daypicker     seven real checkboxes: .daypicker__day > input + span
.pubbtn        the one button that carries the feedback: data-state="idle|ready|saving|busy|live|invalid|error"
.studio        editor: __tree (__list > __row > __fold + __node[data-kind], nested __sub), __stage (__frame), __props[data-open], __switch
.portal__bar   top bar: __tab[aria-current] (a page, or Site-wide), __seg > __segbtn (preview size, icons), .pubbtn, __account > __iconbtn + __menu > __menuitem
```

## Catalog

Admin UI (in `components.css`)  ·  see **`components.html#admin-ui`**

The owner portal's building blocks, for any screen where someone edits data. They reuse `.field`, `.input`, `.choice`, `.btn`, `.modal`, `.alert` and `.badge`; four blocks were added.

| Component | Markup | What it is |
|---|---|---|
| Portal shell | `.portal` > `header.portal__bar` (sticky top bar: `.portal__brand`, `nav.portal__nav` of `.portal__tab[aria-current=page]` buttons (one per page, then Site-wide), `.portal__end` = `.portal__seg` of icon `.portal__segbtn`s (preview size), `.pubbtn`, then `.portal__account` > `.portal__iconbtn` + `.portal__menu[role=menu]` > `.portal__menuitem`), `.portal__facts` (Account), `.portal__photos` (photos used), `.imagefield` (the photo control: `__thumb`, `__img`, `__none`, `__file`, `__actions`, `__status`), `.portal__cards` > `.portal__card`, `.portal__help`, `.portal__meta`, `.portal__list`, `.portal__sr` | The page: one top bar holding every control (tabs, preview size, Publish, account menu), a stack of section cards, an editor, a history list |
| List editor | `.listedit` > `details.listedit__item.listedit__row` > `summary.listedit__itemsummary`, `__fields`, `__times`, `__actions`; `.listedit__head` + `.listedit__add` (the "+"); `.listedit__nested` for a list inside a row | An ordered list of collapsible rows (a summary line that opens to the fields) with Move up / Move down / Remove buttons (not drag only) and a "+" button, placed beside the editor's title, that adds a row. A schema marked `"tree": true` also shows each row under its module in the Studio tree. |
| Day picker | `fieldset.daypicker` > `label.daypicker__day` > `input[type=checkbox]` + `span` | Seven real checkboxes drawn as toggle buttons; 44 px touch targets |
| Publish button | `button.btn.pubbtn[data-state]` (+ `.pubbtn__spin`) | One button that says what is happening: Up to date, Publish, Saving…, Couldn't save. Retrying…, Publishing…, Live ✓, Fix the highlighted fields, Try again. No helper text; a screen-reader-only live region repeats each change |
| Studio | `.studio` > `.studio__tree` (`ul.studio__list` > `li` > `.studio__row` (`.studio__fold` + `button.studio__node[data-kind=edit|managed]` with a `.studio__icon` and `.studio__label`) + nested `ul.studio__sub`), `.studio__stage` (`iframe.studio__frame`, `[data-device]`), `.studio__props`, `.studio__switch` | The owner portal's editor: tree of the page's parts, live preview, properties. Three panes on desktop; on phones a row of chips over the page, the properties as a bottom sheet (`[data-open]`), a Preview/Edit switch. The tree shows the current tab (a page, or Site-wide) and nests blocks the way the page does (`li[data-open]`, `aria-expanded`); an icon per block (`portal-icons.js`, inline SVG, stroke only), brand-coloured when editable; grey text = looked after by Kleaver (the row also carries a `title`). The preview frame is a script-free sandbox filled by `portal-preview.js` |

`site/scripts/portal.js` and `portal-fields.js` build all of this from a module's schema with `createElement` and `textContent` only (never `innerHTML`); the build's dependency list (`COMPONENT_DEPS.portal` in `scripts/fingerprint.js`) keeps the blocks they need.
