# `MishkaCmsCoreWeb.Live.Admin.Dashboard.Runtime.Component.Index`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core_web/live/admin/dashboard/runtime/component/index.ex#L5)

The admin's component list, and the modal that makes a new one.

## Two ways to create, both on the "+ Add" button

The button that opens the create modal carries a caret, and the caret holds the two ways of ending
up in the visual editor with a new component:

  * **Fill in the details, then open the editor** — pressing it records the intent in
    `open_builder?` and opens the ordinary modal. The save that follows is the ordinary save; the
    guarded `{:form_saved, :create, result}` clause below turns it into a redirect. The question is
    asked where the reader is choosing how to make one, not at the bottom of a modal they have
    already committed to.
  * **Create empty & open editor** — a plain link to `/admin/dashboard/runtime/builder/component`.
    It LEAVES without opening the modal at all, so none of this form's validations fire on a form
    the reader has just said they do not want to fill in; the editor asks for the two or three
    things a record cannot exist without and makes it there.

## One modal for everything

Creating, viewing and editing all happen in the inspector modal's Configuration tab
(`MishkaCmsCoreWeb.Live.Admin.Dashboard.Runtime.PreviewHelpers`). There is no separate
`component-form-modal`: two mounts of one form component on a page collide on their DOM id, and the
form is what an author edits after reading the very tabs beside it.

## Duplicate

The inspector's header offers **Duplicate** on this page and on no other runtime table: it writes
`<name>-copy-<4 characters>` beside the open component, closes the modal and flashes the new name.
The copy reaches the table through the resource's own `component:*` broadcast, like any create.
See `MishkaCmsCore.Runtime.ComponentCopy`.

# `render`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
